mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-25 14:18:41 -05: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>
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
jest.mock('shared/supabase/init');
|
|
|
|
import * as supabaseInit from "shared/supabase/init";
|
|
import { AuthedUser } from "api/helpers/endpoint";
|
|
|
|
describe('createComment', () => {
|
|
let mockPg: any;
|
|
beforeEach(() => {
|
|
jest.resetAllMocks();
|
|
|
|
mockPg = {
|
|
one: jest.fn()
|
|
};
|
|
|
|
(supabaseInit.createSupabaseDirectClient as jest.Mock)
|
|
.mockReturnValue(mockPg);
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
describe('should', () => {
|
|
it('successfully create a comment with information provided', async () => {
|
|
const mockUserId = {userId: '123'}
|
|
const mockOnUser = {id: '123'}
|
|
const mockCreator = {
|
|
id: '123',
|
|
name: 'Mock Creator',
|
|
username: 'mock.creator.username',
|
|
avatarUrl: 'mock.creator.avatarurl'
|
|
}
|
|
const mockContent = {
|
|
content: {
|
|
type: 'doc',
|
|
content: [
|
|
{
|
|
type: 'paragraph',
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: 'This is the comment text'
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
userId: '123'
|
|
};
|
|
const mockAuth = { uid: '321' } as AuthedUser;
|
|
const mockReplyToCommentId = {} as any;
|
|
|
|
|
|
});
|
|
});
|
|
}); |