Skip to content

Commit

Permalink
Add cursory test for getVisitorCountByColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Jan 14, 2024
1 parent 95e5dbb commit e883210
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/analytics/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,34 @@ describe("AnalyticsEngineAPI", () => {
});
});
});

describe("getVisitorCountByColumn", () => {
test("it should map logical columns to schema columns and return an array of [column, count] tuples", async () => {
fetch.mockResolvedValue(new Promise(resolve => {
resolve(createFetchResponse({
data: [
{
blob4: "CA",
count: 3,
},
{
blob4: "US",
count: 2,
},
{
blob4: "GB",
count: 1,
}
]
}))
}));

const result = await api.getVisitorCountByColumn("example.com", "country", 7);
expect(result).toEqual([
["CA", 3],
["US", 2],
["GB", 1],
]);
});
});
});

0 comments on commit e883210

Please sign in to comment.