Skip to content

Commit

Permalink
refactor(concepts):ava to mocha (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshqlogic authored and fhinkel committed Mar 1, 2019
1 parent 0c7be74 commit 0634546
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 4 additions & 1 deletion functions/concepts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"ava": "^0.25.0",
"mocha": "^5.2.0",
"sinon": "^7.0.0",
"supertest": "^3.0.0"
},
"scripts": {
"test": "mocha test/*.test.js --timeout=20000"
}
}
22 changes: 11 additions & 11 deletions functions/concepts/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

'use strict';

const sinon = require(`sinon`);
const test = require(`ava`);
const tools = require(`@google-cloud/nodejs-repo-tools`);
const sinon = require('sinon');
const assert = require('assert');
const tools = require('@google-cloud/nodejs-repo-tools');

const sample = require(`../`);
const sample = require('../');

test.beforeEach(tools.stubConsole);
test.afterEach.always(tools.restoreConsole);
beforeEach(tools.stubConsole);
afterEach(tools.restoreConsole);

test(`should demonstrate error type behavior`, t => {
it('should demonstrate error type behavior', () => {
const objError = new Error('Error object!');
const strError = new Error('Error string!');

Expand All @@ -33,12 +33,12 @@ test(`should demonstrate error type behavior`, t => {

// Test throwing both objects and strings
sample.errorTypes(req, res);
t.deepEqual(console.error.getCall(0).args, [objError]);
t.deepEqual(console.error.getCall(1).args, [strError]);
assert.deepStrictEqual(console.error.getCall(0).args, [objError]);
assert.deepStrictEqual(console.error.getCall(1).args, [strError]);

// Test throwing objects only
req.body.throwAsString = false;
sample.errorTypes(req, res);
t.deepEqual(console.error.getCall(2).args, [objError]);
t.deepEqual(console.error.getCall(3).args, [objError]);
assert.deepStrictEqual(console.error.getCall(2).args, [objError]);
assert.deepStrictEqual(console.error.getCall(3).args, [objError]);
});

0 comments on commit 0634546

Please sign in to comment.