Skip to content

Commit a6c257f

Browse files
authored
Merge pull request #29 from node-oauth/chai
Replace exception library Should with Chai
2 parents 4d893e4 + 4003209 commit a6c257f

28 files changed

+84
-91
lines changed

package-lock.json

Lines changed: 47 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"type-is": "1.6.18"
2626
},
2727
"devDependencies": {
28+
"chai": "^4.3.4",
2829
"jshint": "2.13.0",
2930
"mocha": "5.2.0",
3031
"nyc": "^15.1.0",
31-
"should": "13.2.3",
3232
"sinon": "7.5.0"
3333
},
3434
"license": "MIT",

test/assertions.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
* Module dependencies.
55
*/
66

7-
var should = require('should');
7+
var chai = require('chai');
88

99
/**
1010
* SHA-1 assertion.
1111
*/
12+
chai.use(function (_chai, utils) {
1213

13-
should.Assertion.add('sha1', function() {
14-
this.params = { operator: 'to be a valid SHA-1 hash' };
15-
16-
this.obj.should.match(/^[a-f0-9]{40}$/i);
17-
}, true);
14+
utils.addMethod(chai.Assertion.prototype, 'sha1', function () {
15+
var obj = utils.flag(this, 'object');
16+
new chai.Assertion(obj).match(/^[a-f0-9]{40}$/i);
17+
});
18+
19+
});

test/integration/grant-types/abstract-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var AbstractGrantType = require('../../../lib/grant-types/abstract-grant-type');
88
var InvalidArgumentError = require('../../../lib/errors/invalid-argument-error');
99
var Promise = require('bluebird');
1010
var Request = require('../../../lib/request');
11-
var should = require('should');
11+
var should = require('chai').should();
1212

1313
/**
1414
* Test `AbstractGrantType` integration.

test/integration/grant-types/authorization-code-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var InvalidRequestError = require('../../../lib/errors/invalid-request-error');
1111
var Promise = require('bluebird');
1212
var Request = require('../../../lib/request');
1313
var ServerError = require('../../../lib/errors/server-error');
14-
var should = require('should');
14+
var should = require('chai').should();
1515

1616
/**
1717
* Test `AuthorizationCodeGrantType` integration.

test/integration/grant-types/client-credentials-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var InvalidArgumentError = require('../../../lib/errors/invalid-argument-error')
99
var InvalidGrantError = require('../../../lib/errors/invalid-grant-error');
1010
var Promise = require('bluebird');
1111
var Request = require('../../../lib/request');
12-
var should = require('should');
12+
var should = require('chai').should();
1313

1414
/**
1515
* Test `ClientCredentialsGrantType` integration.

test/integration/grant-types/password-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var InvalidRequestError = require('../../../lib/errors/invalid-request-error');
1010
var PasswordGrantType = require('../../../lib/grant-types/password-grant-type');
1111
var Promise = require('bluebird');
1212
var Request = require('../../../lib/request');
13-
var should = require('should');
13+
var should = require('chai').should();
1414

1515
/**
1616
* Test `PasswordGrantType` integration.

test/integration/grant-types/refresh-token-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var Promise = require('bluebird');
1111
var RefreshTokenGrantType = require('../../../lib/grant-types/refresh-token-grant-type');
1212
var Request = require('../../../lib/request');
1313
var ServerError = require('../../../lib/errors/server-error');
14-
var should = require('should');
14+
var should = require('chai').should();
1515

1616
/**
1717
* Test `RefreshTokenGrantType` integration.

test/integration/handlers/authenticate-handler_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Request = require('../../../lib/request');
1515
var Response = require('../../../lib/response');
1616
var ServerError = require('../../../lib/errors/server-error');
1717
var UnauthorizedRequestError = require('../../../lib/errors/unauthorized-request-error');
18-
var should = require('should');
18+
var should = require('chai').should();
1919

2020
/**
2121
* Test `AuthenticateHandler` integration.

test/integration/handlers/authorize-handler_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var Request = require('../../../lib/request');
1818
var Response = require('../../../lib/response');
1919
var ServerError = require('../../../lib/errors/server-error');
2020
var UnauthorizedClientError = require('../../../lib/errors/unauthorized-client-error');
21-
var should = require('should');
21+
var should = require('chai').should();
2222
var url = require('url');
2323

2424
/**

0 commit comments

Comments
 (0)