tracman-server/test/index.js

49 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2017-12-21 14:49:07 -07:00
'use strict'
2017-12-18 23:33:55 -07:00
const chai = require('chai')
const request = require('supertest')
2017-12-21 14:49:07 -07:00
.agent(require('../server'))
chai.use(
require('chai-http')
)
2017-12-18 23:33:55 -07:00
describe('Index routes', () => {
it( 'Displays homepage', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/')
2017-12-18 23:33:55 -07:00
chai.expect(res).html.to.have.status(200)
})
it('Displays help page', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/help')
2017-12-18 23:33:55 -07:00
chai.expect(res).html.to.have.status(200)
})
it('Displays terms of service', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/terms')
2017-12-18 23:33:55 -07:00
chai.expect(res).html.to.have.status(200)
})
it('Displays privacy policy', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/privacy')
2017-12-18 23:33:55 -07:00
chai.expect(res).html.to.have.status(200)
})
it('Displays robots.txt', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/')
2017-12-18 23:33:55 -07:00
chai.expect(res).to.have.status(200)//.to.be.text Not sure why mocha's
// getting text/html in mocha; it's showing text/plain in chrome
})
it('Redirects /signup to /logn#signup', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/signup')
2017-12-18 23:33:55 -07:00
chai.expect(res).to.redirectTo('/login#signup')
})
it('Redirects /demo to /map/demo', async () => {
2017-12-21 14:49:07 -07:00
let res = await request.get('/demo')
2017-12-18 23:33:55 -07:00
chai.expect(res).to.redirectTo('/map/demo')
})
})