Consolidating usage of test/it in tests
This commit is contained in:
parent
1f5824ac49
commit
34107e3d58
1 changed files with 6 additions and 6 deletions
|
|
@ -24,7 +24,7 @@ describe('server', () => {
|
||||||
jest.resetAllMocks()
|
jest.resetAllMocks()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should accept POST to /reservations', async () => {
|
test('should accept POST to /reservations', async () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(scheduler, 'work')
|
.spyOn(scheduler, 'work')
|
||||||
.mockImplementationOnce(() => Promise.resolve({}))
|
.mockImplementationOnce(() => Promise.resolve({}))
|
||||||
|
|
@ -36,7 +36,7 @@ describe('server', () => {
|
||||||
expect(response.status).toBe(200)
|
expect(response.status).toBe(200)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject non-POST request', async () => {
|
test('should reject non-POST request', async () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(scheduler, 'work')
|
.spyOn(scheduler, 'work')
|
||||||
.mockImplementationOnce(() => Promise.resolve({}))
|
.mockImplementationOnce(() => Promise.resolve({}))
|
||||||
|
|
@ -45,7 +45,7 @@ describe('server', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject request to other route', async () => {
|
test('should reject request to other route', async () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(scheduler, 'work')
|
.spyOn(scheduler, 'work')
|
||||||
.mockImplementationOnce(() => Promise.resolve({}))
|
.mockImplementationOnce(() => Promise.resolve({}))
|
||||||
|
|
@ -54,7 +54,7 @@ describe('server', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject request without content-type of json', async () => {
|
test('should reject request without content-type of json', async () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(scheduler, 'work')
|
.spyOn(scheduler, 'work')
|
||||||
.mockImplementationOnce(() => Promise.resolve({}))
|
.mockImplementationOnce(() => Promise.resolve({}))
|
||||||
|
|
@ -65,7 +65,7 @@ describe('server', () => {
|
||||||
).rejects.toThrow(axios.AxiosError)
|
).rejects.toThrow(axios.AxiosError)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject request if body cannot be parsed', async () => {
|
test('should reject request if body cannot be parsed', async () => {
|
||||||
jest.spyOn(utils, 'parseJson').mockImplementationOnce(Promise.reject)
|
jest.spyOn(utils, 'parseJson').mockImplementationOnce(Promise.reject)
|
||||||
await expect(() =>
|
await expect(() =>
|
||||||
axios.post(
|
axios.post(
|
||||||
|
|
@ -78,7 +78,7 @@ describe('server', () => {
|
||||||
).rejects.toThrow(axios.AxiosError)
|
).rejects.toThrow(axios.AxiosError)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject request if schedule cannot be performed', async () => {
|
test('should reject request if schedule cannot be performed', async () => {
|
||||||
jest.spyOn(scheduler, 'work').mockImplementationOnce(Promise.reject)
|
jest.spyOn(scheduler, 'work').mockImplementationOnce(Promise.reject)
|
||||||
await expect(() =>
|
await expect(() =>
|
||||||
axios.post(
|
axios.post(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue