Skip to content

Commit

Permalink
add 'getUniqueLabelsForDays' test with duplicated labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji14 committed Jun 3, 2024
1 parent 461e5fe commit 60ca15c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions www/__tests__/metricsHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@ window['i18next'] = initializedI18next;

describe('metricsHelper', () => {
describe('getUniqueLabelsForDays', () => {
const days1 = [
{ mode_confirm_a: 1, mode_confirm_b: 2 },
{ mode_confirm_b: 1, mode_confirm_c: 3 },
{ mode_confirm_c: 1, mode_confirm_d: 3 },
] as any as DayOfMetricData[];
it("should return unique labels for days with 'mode_confirm_*'", () => {
const days1 = [
{ mode_confirm_a: 1, mode_confirm_b: 2 },
{ mode_confirm_b: 1, mode_confirm_c: 3 },
{ mode_confirm_c: 1, mode_confirm_d: 3 },
] as any as DayOfMetricData[];
expect(getUniqueLabelsForDays(days1)).toEqual(['a', 'b', 'c', 'd']);
});

it('should return unique labels for days with duplicated labels', () => {
const days2 = [
{ mode_confirm_a: 1, mode_confirm_b: 2 },
{ mode_confirm_a: 1, mode_confirm_b: 2 },
{ mode_confirm_a: 1, mode_confirm_b: 2 },
] as any as DayOfMetricData[];
expect(getUniqueLabelsForDays(days2)).toEqual(['a', 'b']);
});
});

describe('getLabelsForDay', () => {
Expand Down

0 comments on commit 60ca15c

Please sign in to comment.