Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

BUG 1061290 chai add interfaces expect and should #23613

Merged
merged 1 commit into from Sep 9, 2014

Conversation

sv99
Copy link
Contributor

@sv99 sv99 commented Sep 2, 2014

Now available only assert interface from chai assertion library.

In assert interface not available methods for testing property. Same unit tests used for in assert.include - this assert worked only for strings and Arrays, for objects this method in used version chai do nothing.

@try-server-hook
Copy link

sv99 sv99 started tests. Results

@@ -111,6 +111,8 @@
chai.Assertion.includeStack = true;
patchChai(chai.Assertion);
window.assert = chai.assert;
window.expect = chai.expect;
window.should = chai.should();
Copy link
Contributor

Choose a reason for hiding this comment

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

Supposedly it should be should instead of should(), @sv99, is this a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tue, 02 Sep 2014 01:18:44 -0700 от Yuren Ju notifications@github.com:

In dev_apps/test-agent/common/test/helper.js:

@@ -111,6 +111,8 @@
chai.Assertion.includeStack = true;
patchChai(chai.Assertion);
window.assert = chai.assert;

  • window.expect = chai.expect;
  • window.should = chai.should();
    Supposedly it should be should instead of should(), @sv99 , is this a typo?

    Reply to this email directly or view it on GitHub . common/vendor/chai/chai.js
    66:* ### BDD Style Introduction
     *
     * The BDD style is exposed through expect or should interfaces. In both
     * scenarios, you chain together natural language assertions.
     *
     _      // expect
     _      var expect = require('chai').expect;
     _      expect(foo).to.equal('bar');
     _
     _      // should
     _      var should = require('chai').should();
     *      foo.should.equal('bar');

Sample uncorrect using assert.include in  apps/clock/test/unit/picker/picker_test.js
assert.include(Picker.prototype, 'reset');

Picker.prototype - object? for object assert.include do nothing

assert.include(Picker.prototype, 'reset');
assert.include(Picker.prototype, 'reset1'); // assert OK !!!

expect(Picker.prototype).to.have.property('reset');
Picker.prototype.should.have.property('reset');

С уважением, Волков Вячеслав!

@try-server-hook
Copy link

sv99 sv99 started tests. Results

@try-server-hook
Copy link

sv99 sv99 started tests. Results

@try-server-hook
Copy link

sv99 sv99 started tests. Results

yurenju added a commit that referenced this pull request Sep 9, 2014
BUG 1061290 chai add interfaces expect and should r=@yurenju
@yurenju yurenju merged commit df38314 into mozilla-b2g:master Sep 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants