Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
fix(formatting): fix bad data formatting on visits count (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alezco authored Apr 13, 2021
1 parent edec5e4 commit 630b96f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/matomo/matomo-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ type TestData =
| (MatomoEventCategory & {
otherKey: string;
})[]
| number;
| number
| { value: number };

describe("matomoUtils", () => {
describe("getBulkRequestParamsFromConfig", () => {
Expand Down Expand Up @@ -86,7 +87,7 @@ describe("matomoUtils", () => {
// eslint-disable-next-line @typescript-eslint/naming-convention
[{ label: "label2", nb_events: 20, otherKey: "otherKey" }],
[{ label: "label3", nb_events: 30, otherKey: "otherKey" }],
42,
{ value: 42 },
];

expect(createMatomoDataSanitizer(siteConfig)(matomoData)).toEqual([
Expand Down
11 changes: 8 additions & 3 deletions src/matomo/matomo-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,14 @@ const formatMonthlyEvents = (config: MatomoEventConfig): ResultFormatter[] =>
compose(map(formatMonthlyApiResult(config, date)), formatter)
);

const formatVisitsResponse = () => (
value: number
): ArchifiltreCountStatistic => ({ label: "visitsCount", value });
const formatVisitsResponse = () => ({
value,
}: {
value: number;
}): ArchifiltreCountStatistic => ({
label: "visitsCount",
value,
});

const formatVisitorCountriesResponse = () => (
countries: MatomoUserCountry[]
Expand Down

0 comments on commit 630b96f

Please sign in to comment.