2
1
mirror of https://github.com/Thream/api.git synced 2024-07-21 03:38:31 +02:00
api/generators/service/service.test.ts.hbs
2021-10-24 04:18:18 +02:00

27 lines
800 B
Handlebars

import { application } from 'application.js'
{{#if shouldBeAuthenticated}}
import { authenticateUserTest } from '__test__/utils/authenticateUserTest.js'
{{/if}}
import { prismaMock } from '__test__/setup.js'
describe('{{httpMethod}} {{url}}', () => {
it('succeeds', async () => {
// prismaMock.service.findUnique.mockResolvedValue(null)
{{#if shouldBeAuthenticated}}
const { accessToken, user } = await authenticateUserTest()
{{/if}}
const response = await application.inject({
method: '{{httpMethod}}',
url: '{{url}}',
{{#if shouldBeAuthenticated}}
headers: {
authorization: `Bearer ${accessToken}`
},
{{/if}}
payload: {}
})
// const responseJson = response.json()
expect(response.statusCode).toEqual(200)
})
})