Skip to content
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

chaijs 1.10 allows to write lint-friendly tests #13

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"expr": true
"esnext": true
}
2 changes: 1 addition & 1 deletion tests/describe-component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describeComponent('pretty-color', {

it("has the correct className", function() {
// first call to this.$() renders the component.
expect(this.$().is('.pretty-color')).to.be.true;
expect(this.$().is('.pretty-color')).to.be.true();
});

it("uses the correct custom template", function() {
Expand Down
7 changes: 3 additions & 4 deletions tests/describe-model-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describeModel('whazzit', 'model:whazzit without adapter', {

it('model exists as subject', function() {
var model = this.subject();
expect(model).to.exist;
expect(model).to.exist();
expect(model).to.be.an.instanceof(DS.Model);
expect(model).to.be.an.instanceof(Whazzit);
});
Expand Down Expand Up @@ -86,13 +86,13 @@ describeModel('whazzit', 'model:whazzit with custom adapter', {
var model = this.subject(),
store = this.store();

expect(whazzitAdapterFindAllCalled).to.be.false;
expect(whazzitAdapterFindAllCalled).to.be.false();

store = this.store();

return Ember.run(function() {
return store.find('whazzit').then(function() {
expect(whazzitAdapterFindAllCalled).to.be.true;
expect(whazzitAdapterFindAllCalled).to.be.true();
done();
});
});
Expand Down Expand Up @@ -125,4 +125,3 @@ describeModel('whazzit', 'model:whazzit with application adapter', {
});

});

10 changes: 5 additions & 5 deletions tests/it-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ describe('it', function() {
});

it('does not throw errors when you mark a pending spec', function() {
expect(pendingError).to.be.null;
expect(pendingError).to.be.null();
var pendingSpec = window.mocha.suite.suites.find(function(suite) {
return suite.tests.find(function(test) {
return test.title === 'is a pending spec';
});
});
expect(pendingSpec).to.be.ok;
expect(pendingSpec).to.be.ok();
});


Expand All @@ -67,13 +67,13 @@ describe('it', function() {
});

it('skips tests with the .skip modifier', function() {
expect(skippedError).to.be.null;
expect(skippedError).to.be.null();
var pendingSpec = Mocha.suite.suites.find(function(suite) {
return suite.tests.find(function(test) {
return test.title === 'a skipped spec';
return test.title === 'is a skipped spec';
});
});
expect(pendingSpec).to.be.defined;
expect(pendingSpec).to.exist();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually never doing the intended verification of pendingSpec. defined is actually not a defined chai assertion and so this was testing for undefined. The new function syntax prevents those errors.

});

var callback = function() {
Expand Down