Show all metric insights with descriptions
This commit is contained in:
1 parent
741fce0adb
commit
cfbc74d882
9 files changed
+171
-33
No files matched your search
@@ -144,15 +144,25 @@ describe('AnalysisReadService', () => {
|
||||
(metric) => metric.metricId === 'deathWithShutdownBountyGivenRate',
|
||||
),
|
||||
).toBe(false);
|
||||
expect(analysis.strengths).toEqual([
|
||||
expect(analysis.strengths).toHaveLength(12);
|
||||
expect(analysis.weaknesses).toHaveLength(12);
|
||||
expect(analysis.strengths.slice(0, 3)).toEqual([
|
||||
{ metricId: 'deathsPerMin', value: 0.1 },
|
||||
{ metricId: 'kda', value: 0.8 },
|
||||
{ metricId: 'killParticipation', value: 0.7 },
|
||||
]);
|
||||
expect(analysis.weaknesses).toEqual([
|
||||
expect(analysis.strengths.at(-1)).toEqual({
|
||||
metricId: 'wardsKilledPerMin',
|
||||
value: 0.1,
|
||||
});
|
||||
expect(analysis.weaknesses.slice(0, 3)).toEqual([
|
||||
{ metricId: 'wardsKilledPerMin', value: 0.1 },
|
||||
{ metricId: 'visionScorePerMin', value: 0.2 },
|
||||
{ metricId: 'controlWardsPlaced', value: 0.2 },
|
||||
]);
|
||||
expect(analysis.weaknesses.at(-1)).toEqual({
|
||||
metricId: 'deathsPerMin',
|
||||
value: 0.1,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -201,7 +201,6 @@ export class AnalysisReadService {
|
||||
? right.score - left.score
|
||||
: left.score - right.score,
|
||||
)
|
||||
.slice(0, 3)
|
||||
.map(({ metricId, value }) => ({ metricId, value }));
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,8 @@ describe('shared feature registry', () => {
|
||||
|
||||
expect(new Set(metricIds).size).toBe(metricIds.length);
|
||||
for (const metric of METRICS) {
|
||||
expect(metric.label).toBeTruthy();
|
||||
expect(metric.label.trim()).toBeTruthy();
|
||||
expect(metric.description.trim()).toBeTruthy();
|
||||
expect(metric.baseline).toBeDefined();
|
||||
expect(Object.keys(metric.baseline ?? {}).sort()).toEqual([
|
||||
'BOTTOM',
|
||||
|
||||
@@ -353,7 +353,7 @@ describe('AppController (e2e)', () => {
|
||||
queueId: 420,
|
||||
featureSchemaVersion: FEATURE_SCHEMA_VERSION,
|
||||
});
|
||||
expect(responseBody).toEqual({
|
||||
expect(responseBody).toMatchObject({
|
||||
account: {
|
||||
gameName: 'Hide on bush',
|
||||
profileIconId: 1,
|
||||
@@ -392,18 +392,36 @@ describe('AppController (e2e)', () => {
|
||||
queueId: 420,
|
||||
sampleGameCount: 12,
|
||||
},
|
||||
strengths: [
|
||||
updatedAt: '2026-07-02T00:00:00.000Z',
|
||||
});
|
||||
expect(responseBody.strengths).toHaveLength(12);
|
||||
expect(responseBody.weaknesses).toHaveLength(12);
|
||||
expect(responseBody.strengths).toEqual(
|
||||
expect.arrayContaining([
|
||||
{ metricId: 'deathsPerMin', value: 0.1 },
|
||||
{ metricId: 'kda', value: 0.8 },
|
||||
{ metricId: 'killParticipation', value: 0.7 },
|
||||
],
|
||||
weaknesses: [
|
||||
{ metricId: 'wardsKilledPerMin', value: 0.1 },
|
||||
]),
|
||||
);
|
||||
expect(responseBody.weaknesses).toEqual(
|
||||
expect.arrayContaining([
|
||||
{ metricId: 'wardsKilledPerMin', value: 0.1 },
|
||||
{ metricId: 'visionScorePerMin', value: 0.2 },
|
||||
{ metricId: 'controlWardsPlaced', value: 0.2 },
|
||||
],
|
||||
updatedAt: '2026-07-02T00:00:00.000Z',
|
||||
});
|
||||
{ metricId: 'deathsPerMin', value: 0.1 },
|
||||
]),
|
||||
);
|
||||
expect(responseBody.strengths.slice(0, 3)).toEqual([
|
||||
{ metricId: 'deathsPerMin', value: 0.1 },
|
||||
{ metricId: 'kda', value: 0.8 },
|
||||
{ metricId: 'killParticipation', value: 0.7 },
|
||||
]);
|
||||
expect(responseBody.weaknesses.slice(0, 3)).toEqual([
|
||||
{ metricId: 'wardsKilledPerMin', value: 0.1 },
|
||||
{ metricId: 'visionScorePerMin', value: 0.2 },
|
||||
{ metricId: 'controlWardsPlaced', value: 0.2 },
|
||||
]);
|
||||
});
|
||||
|
||||
it('/api/players/:puuid/analysis/latest (GET) returns 404 without a profile', async () => {
|
||||
|
||||
Reference in new issue
Block a user