mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-25 10:02:27 -04:00
* 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
30 lines
692 B
TypeScript
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})
|
|
})
|
|
})
|
|
})
|