-
-
Notifications
You must be signed in to change notification settings - Fork 52
replaced assertion library should.js with chai.js #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,16 @@ | |
* Module dependencies. | ||
*/ | ||
|
||
var should = require('should'); | ||
var chai = require('chai'); | ||
|
||
/** | ||
* SHA-1 assertion. | ||
*/ | ||
chai.use(function (_chai, utils) { | ||
|
||
should.Assertion.add('sha1', function() { | ||
this.params = { operator: 'to be a valid SHA-1 hash' }; | ||
|
||
this.obj.should.match(/^[a-f0-9]{40}$/i); | ||
}, true); | ||
utils.addMethod(chai.Assertion.prototype, 'sha1', function (str) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. linter says " 'str' is defined but never used." |
||
var obj = utils.flag(this, 'object'); | ||
new chai.Assertion(obj).match(/^[a-f0-9]{40}$/i); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ var ServerError = require('../../../lib/errors/server-error'); | |
var TokenHandler = require('../../../lib/handlers/token-handler'); | ||
var UnauthorizedClientError = require('../../../lib/errors/unauthorized-client-error'); | ||
var UnsupportedGrantTypeError = require('../../../lib/errors/unsupported-grant-type-error'); | ||
var should = require('should'); | ||
var should = require('chai').should(); | ||
var util = require('util'); | ||
|
||
/** | ||
|
@@ -121,8 +121,8 @@ describe('TokenHandler integration', function() { | |
saveToken: function() {} | ||
}; | ||
var handler = new TokenHandler({ accessTokenLifetime: 120, extendedGrantTypes: extendedGrantTypes, model: model, refreshTokenLifetime: 120 }); | ||
|
||
handler.grantTypes.should.containEql(extendedGrantTypes); | ||
console.log(handler.grantTypes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove console.log statements from code |
||
handler.grantTypes.should.deep.include(extendedGrantTypes); | ||
}); | ||
|
||
it('should set the `model`', function() { | ||
|
@@ -997,8 +997,8 @@ describe('TokenHandler integration', function() { | |
}; | ||
var handler = new TokenHandler({ accessTokenLifetime: 120, model: model, refreshTokenLifetime: 120 }); | ||
var tokenType = handler.getTokenType({ accessToken: 'foo', refreshToken: 'bar', scope: 'foobar' }); | ||
|
||
tokenType.should.containEql({ accessToken: 'foo', accessTokenLifetime: undefined, refreshToken: 'bar', scope: 'foobar' }); | ||
console.log(tokenType); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove the console.log statements from code |
||
tokenType.should.deep.include({ accessToken: 'foo', accessTokenLifetime: undefined, refreshToken: 'bar', scope: 'foobar' }); | ||
}); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var TokenModel = require('../../../lib/models/token-model'); | ||
|
||
var should = require('chai').should(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'should' is defined but never used. |
||
/** | ||
* Test `Server`. | ||
*/ | ||
|
@@ -18,7 +18,7 @@ describe('Model', function() { | |
}; | ||
|
||
var model = new TokenModel(data); | ||
model.accessTokenLifetime.should.be.Number; | ||
model.accessTokenLifetime.should.a('number'); | ||
model.accessTokenLifetime.should.be.approximately(3600, 2); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove
nyc
? It's used for our coverage report. Please add it again in order to prevent follow-up issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jwerre somehow
nyc
is stil removed, even after pullingdevelopment
. Could you please add it again? It's just runningnpm install --save-dev nyc