Skip to content

Instantly share code, notes, and snippets.

@bewarusman
Created February 5, 2019 06:37
Show Gist options
  • Save bewarusman/2cc0ae4a7378502214a953c3794283eb to your computer and use it in GitHub Desktop.
Save bewarusman/2cc0ae4a7378502214a953c3794283eb to your computer and use it in GitHub Desktop.
const chai = require('chai');
const sinon = require('sinon');
const expect = chai.expect;
const {createTodo, listTodos} = require('./todoController');
describe('todoController', function() {
beforeEach(function() {
req = {body: {text: 'Go to the meeting!'}, db: {TodoModel: {create: null, findAll: null}}};
res = {json: sinon.fake()};
next = sinon.fake();
});
afterEach(function() {
sinon.restore();
});
describe('createTodo', function() {
it('text should be provided');
it('should send success result if todo is saved to database');
it('should send fail result if todo is not saved to database');
});
describe('fetchTodos', function() {
it('should send a list of todos with success message');
it('should send fail result if todo is not fetched from database');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment