aboutsummaryrefslogtreecommitdiff
path: root/test/nodeserver.test.ts
blob: 83c66e8a8bc3740894834f8db440e5729071d288 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as mocha from 'mocha';
import * as chai from 'chai';
import chaiHttp = require('chai-http');

import app from '../src/app';

chai.use(chaiHttp);
const expect = chai.expect;

describe('baseRoute', () => {

  it('should be json', () => {
    return chai.request(app).get('/')
    .then(res => {
      expect(res.type).to.eql('application/json');
    });
  });

  it('should have a message prop', () => {
    return chai.request(app).get('/')
    .then(res => {
      expect(res.body.message).to.eql('Welcome to the CS3099 BE4 server!');
    });
  });
  it('should have an important prop', () => {
    return chai.request(app).get('/')
    .then(res => {
      expect(res.body.important).to.eql('Endpoints start from /cs3099group-be-4/');
    });
  });

});