Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var assert = require('chai').assert;
- var resources = require('./resources.js');
- var sinon = require('sinon');
- describe('resources.js', function() {
- describe('getData()', function() {
- it('calls makeRequest with a built request', function() {
- resources.makeRequest = sinon.spy();
- var resource = 'a resource';
- var request = resources.buildRequest(resource);
- var callback = sinon.spy();
- resources.getData(resource, callback);
- assert.isTrue(
- resources.makeRequest.withArgs(request, callback).calledOnce
- );
- });
- });
- });
- -----
- resources.js
- getData()
- 1) calls makeRequest with a built request
- 0 passing (14ms)
- 1 failing
- 1) resources.js getData() calls makeRequest with a built request:
- AssertionError: expected false to be true
- at Context.<anonymous> (test.spec.js:15:20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement