Files
Compass/backend/api/tests/unit/get-me.unit.test.ts
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

30 lines
692 B
TypeScript

jest.mock('api/get-user')
import {getMe} from 'api/get-me'
import {getUser} from 'api/get-user'
import {AuthedUser} from 'api/helpers/endpoint'
describe('getMe', () => {
beforeEach(() => {
jest.resetAllMocks()
})
afterEach(() => {
jest.restoreAllMocks()
})
describe('when given valid input', () => {
it('should get the user', async () => {
const mockProps = {}
const mockAuth = {uid: '321'} as AuthedUser
const mockReq = {} as any
;(getUser as jest.Mock).mockResolvedValue(null)
await getMe(mockProps, mockAuth, mockReq)
expect(getUser).toBeCalledTimes(1)
expect(getUser).toBeCalledWith({id: mockAuth.uid})
})
})
})