feat(server): implemented SPA mode test
This commit is contained in:
parent
a48ca0616b
commit
a82c4c303e
@ -2,27 +2,34 @@ import request from 'supertest'
|
||||
import { app } from '../app'
|
||||
|
||||
describe('root path requests', () => {
|
||||
it('it responds 200 to the GET method', async () => {
|
||||
it('responds 200 to the GET method', async () => {
|
||||
const result = await request(app).get('/').send()
|
||||
|
||||
expect(result.status).toBe(200)
|
||||
})
|
||||
|
||||
it('it responds 404 to the POST method', async () => {
|
||||
it('responds 404 to the POST method', async () => {
|
||||
const result = await request(app).post('/').send()
|
||||
|
||||
expect(result.status).toBe(404)
|
||||
})
|
||||
|
||||
it('it responds 404 to the PATCH method', async () => {
|
||||
it('responds 404 to the PATCH method', async () => {
|
||||
const result = await request(app).patch('/').send()
|
||||
|
||||
expect(result.status).toBe(404)
|
||||
})
|
||||
|
||||
it('it responds 404 to the DELETE method', async () => {
|
||||
it('responds 404 to the DELETE method', async () => {
|
||||
const result = await request(app).delete('/').send()
|
||||
|
||||
expect(result.status).toBe(404)
|
||||
})
|
||||
|
||||
it('redirects to root when a non existing server route is requested', async () => {
|
||||
const result = await request(app).get('/settings').send()
|
||||
|
||||
expect(result.header.location).toBe('/')
|
||||
expect(result.status).toBe(302)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user