mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-27 02:51:18 -04:00
* setting up test structure * . * added playwright config file, deleted original playwright folder and moved "some.test" file * continued test structure setup * Updating test folder structure * Added database seeding script and backend testing folder structure * removed the database test * Replaced db seeding script * Updated userInformation.ts to use values from choices.tsx * merge prep * removing extra unit test, moving api test to correct folder * Pushing to get help with sql Unit test * Updating get-profiles unit tests * Added more unit tests * . * Added more unit tests * Added getSupabaseToken unit test * . * excluding supabase token test so ci can pass * . * Seperated the seedDatabase func into its own file so it can be accessed seperatly * Fixed failing test * . * . * Fix tests * Fix lint * Clean --------- Co-authored-by: MartinBraquet <martin.braquet@gmail.com>
33 lines
1018 B
TypeScript
33 lines
1018 B
TypeScript
import * as supabaseInit from "shared/supabase/init";
|
|
import {getCompatibleProfiles} from "api/compatible-profiles";
|
|
|
|
jest.mock('shared/supabase/init')
|
|
|
|
describe('getCompatibleProfiles', () => {
|
|
beforeEach(() => {
|
|
jest.resetAllMocks();
|
|
const mockPg = {
|
|
none: jest.fn().mockResolvedValue(null),
|
|
one: jest.fn().mockResolvedValue(null),
|
|
oneOrNone: jest.fn().mockResolvedValue(null),
|
|
any: jest.fn().mockResolvedValue([]),
|
|
map: jest.fn().mockResolvedValue([["abc", {score: 0.69}]]),
|
|
} as any;
|
|
(supabaseInit.createSupabaseDirectClient as jest.Mock)
|
|
.mockReturnValue(mockPg);
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
describe('should', () => {
|
|
it('successfully get compatible profiles when supplied with a valid user Id', async () => {
|
|
const results = await getCompatibleProfiles("123");
|
|
expect(results.status).toEqual('success');
|
|
expect(results.profileCompatibilityScores).toEqual({"abc": {score: 0.69}});
|
|
});
|
|
|
|
});
|
|
});
|