Building a REST-API with Expressjs, Tabel and Postgres | Part-3
TDD; Test Driven Development of an Expressjs app with mocha and chai.
Test
Lets write a quick test :
npm install chai-http --save-dev
create a new file routes.index.test.js in test directory
touch test/routes.index.test.js
'use strict'; process.env.NODE_ENV = 'test'; const chai = require('chai'); const should = chai.should(); const chaiHttp = require('chai-http'); chai.use(chaiHttp); const server = require('../server'); describe('routes : index', () => { describe('GET /', () => { it('should return json', (done) => { chai.
read more