Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
licitdev committed May 3, 2024
1 parent e00cff7 commit bd44bba
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions api/src/telemetry/utils/get-user-count.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Knex } from 'knex';
import { afterEach, beforeEach, expect, test, vi } from 'vitest';
import { getUserCount } from './get-user-count.js';

let mockResult: { admin_access: number; app_access: number; count: string }[];
let mockResult: { admin_access: number | null; app_access: number | null; count: string }[];
let mockDb: Knex;

beforeEach(() => {
Expand All @@ -22,6 +22,17 @@ beforeEach(() => {
app_access: 0,
count: '25',
},
{
admin_access: 1,
app_access: 0,
count: '30',
},
{
// For users with no role
admin_access: null,
app_access: null,
count: '35',
},
];

mockDb = {
Expand Down Expand Up @@ -53,8 +64,8 @@ test('Sets final counts based on combination of admin/app access', async () => {
const res = await getUserCount(mockDb);

expect(res).toEqual({
admin: 15,
admin: 45,
app: 20,
api: 25,
api: 60,
});
});

0 comments on commit bd44bba

Please sign in to comment.