19b6f96ecf
Replace `jest` with `tap`.
38 lines
954 B
Handlebars
38 lines
954 B
Handlebars
import tap from 'tap'
|
|
import sinon from 'sinon'
|
|
|
|
import { application } from 'application.js'
|
|
{{#if shouldBeAuthenticated}}
|
|
import { authenticateUserTest } from '__test__/utils/authenticateUserTest.js'
|
|
{{/if}}
|
|
import prisma from 'tools/database/prisma.js'
|
|
|
|
await tap.test('{{httpMethod}} {{url}}', async (t) => {
|
|
t.afterEach(() => {
|
|
sinon.restore()
|
|
})
|
|
|
|
await t.test('succeeds', async (t) => {
|
|
{{#if shouldBeAuthenticated}}
|
|
const { accessToken } = await authenticateUserTest()
|
|
{{/if}}
|
|
sinon.stub(prisma, 'channel').value({
|
|
findFirst: async () => {
|
|
return null
|
|
}
|
|
})
|
|
const response = await application.inject({
|
|
method: '{{httpMethod}}',
|
|
url: '{{url}}',
|
|
{{#if shouldBeAuthenticated}}
|
|
headers: {
|
|
authorization: `Bearer ${accessToken}`
|
|
},
|
|
{{/if}}
|
|
payload: {}
|
|
})
|
|
// const responseJson = response.json()
|
|
t.equal(response.statusCode, 200)
|
|
})
|
|
})
|