This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
api/generators/service/service.test.ts.hbs

27 lines
800 B
Handlebars
Raw Normal View History

2021-10-24 04:18:18 +02:00
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)
})
})