61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
const request = require('supertest');
|
|
const { expect } = require('chai');
|
|
const app = require('../../src/app');
|
|
|
|
describe('GET /benchmark', () => {
|
|
beforeEach(async () => {
|
|
const res = await request(app).get('/benchmark');
|
|
this.res = res;
|
|
});
|
|
|
|
it('Benchmark base route should return a redirect', async () => {
|
|
expect(this.res.status).to.equal(302);
|
|
});
|
|
|
|
it('Benchmark base route should return an HTML response', async () => {
|
|
expect(this.res.headers['content-type']).contains('text/plain');
|
|
});
|
|
|
|
it('Benchmark base route should redirect to /benchmark/list', async () => {
|
|
expect(this.res.headers['location']).contains('/benchmark/list');
|
|
});
|
|
});
|
|
|
|
describe('GET /benchmark/list', () => {
|
|
beforeEach(async () => {
|
|
const res = await request(app).get('/benchmark/list');
|
|
this.res = res;
|
|
});
|
|
|
|
it('Benchmark list route should return a 200 status', async () => {
|
|
expect(this.res.status).to.equal(200);
|
|
});
|
|
|
|
it('Benchmark list route should return an HTML response', async () => {
|
|
expect(this.res.headers['content-type']).contains('text/html');
|
|
});
|
|
|
|
it('Benchmark list route should contain "List of Benchmarks" in body', async() => {
|
|
expect(this.res.text).contains('List of Benchmarks');
|
|
});
|
|
});
|
|
|
|
describe('GET /benchmark/add', () => {
|
|
beforeEach(async () => {
|
|
const res = await request(app).get('/benchmark/add');
|
|
this.res = res;
|
|
});
|
|
|
|
it('Benchmark add route should return a 200 status', async () => {
|
|
expect(this.res.status).to.equal(200);
|
|
});
|
|
|
|
it('Benchmark add route should return an HTML response', async () => {
|
|
expect(this.res.headers['content-type']).contains('text/html');
|
|
});
|
|
|
|
it('Benchmark add route should contain "Add a Benchmark" in body', async() => {
|
|
expect(this.res.text).contains('Add a Benchmark');
|
|
});
|
|
});
|