Closed Bug 1061290 Opened 10 years ago Closed 10 years ago

gaia:test_agent add chai expect and should interface

Categories

(Firefox OS Graveyard :: Gaia::TestAgent, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sv99, Assigned: sv99)

References

Details

Attachments

(3 files)

451 bytes, patch
Details | Diff | Splinter Review
46 bytes, text/x-github-pull-request
yurenju
: review+
Details | Review
46 bytes, text/x-github-pull-request
yurenju
: review+
Details | Review
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36

Steps to reproduce:

chia enable only assert interface, not enabled expect and should interfaces 

For testing existing property in objects used assert.include, specified for string and array, not for simple object.

dev_apps/test-agent/common/test/helper.js View  
 @@ -111,6 +111,8 @@
     chai.Assertion.includeStack = true;
     patchChai(chai.Assertion);
     window.assert = chai.assert;
+    window.expect = chai.expect;
+    window.should = chai.should();
   });



Actual results:

sample using assert.include

apps/clock/test/unit/picker/picker_test.js View  
 
   test('shape:prototype ', function() {
     assert.ok(Picker);
     assert.include(Picker.prototype, 'reset');
+    assert.include(Picker.prototype, 'reset1'); // assert OK!! this property not exists !!
     assert.include(Picker.prototype, 'value');
     assert.isNull(Picker.prototype.value);
   });


Expected results:

apps/clock/test/unit/picker/picker_test.js View  
 @@ -15,7 +15,10 @@ suite('Picker', function() {
 
   test('shape:prototype ', function() {
     assert.ok(Picker);
+    expect(Picker.prototype).to.have.property('reset');
+    Picker.prototype.should.to.have.property('value');
     assert.isNull(Picker.prototype.value);
   });
Summary: gaia:test_agent add chia expect and should interface → gaia:test_agent add chai expect and should interface
Attached patch 1061290.diffSplinter Review
Attached file PR
Attachment #8482551 - Flags: review?(yurenju.mozilla)
sv99, I left comment on github, please take a look.
Flags: needinfo?(sv99)
sv99 has replied on github.
Flags: needinfo?(sv99)
Comment on attachment 8482551 [details] [review]
PR

that looks good, but we should have a test case to catch it, I will upload a attchment for test case, please apply it to your pull request and squash to one commit and needinfo? me if your pull request is updated.

thanks for your contribution!
Attachment #8482551 - Flags: review?(yurenju.mozilla) → review+
Assignee: nobody → sv99
Attached file PR
Attachment #8484123 - Flags: review?(yurenju.mozilla)
Comment on attachment 8484123 [details] [review]
PR

I forgot to upload my patch yesterday and you test case looks good so let's land your pull request, thank you!
Attachment #8484123 - Flags: review?(yurenju.mozilla) → review+
sv99, please squash commits in your pull request to one commit for merging.
Flags: needinfo?(sv99)
(In reply to Yuren [:yurenju] from comment #9)
> sv99, please squash commits in your pull request to one commit for merging.

commit squashed
Flags: needinfo?(sv99)
merged, thanks for this contribution!

https://github.com/mozilla-b2g/gaia/commit/df383142490620d259e7a7b4a0a46a930242a339
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
I'm not sure we should support "should", it looks quite useless in our cases (see my comment on the commit).
Flags: needinfo?(yurenju)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: