javascript - ember-konacha-rails isValid AssertionError -


i using ember-konacha-rails test ember.js application,

here model testing:

//sales_rep.js  app.salesrep = ds.model.extend({ firstname: ds.attr('string'), lastname: ds.attr('string'), }); 

here test :

 #= require spec_helper  describe "app.salesrep", ->   beforeeach( ->     test.store = testutil.lookupstore()   )    "is ds.model", ->     assert.ok app.salesrep     assert.ok ds.model.detect(app.salesrep)    describe "attribute: firstname", ->     "can created valid value", ->       ember.run( ->         test.contact = app.salesrep.createrecord firstname: 'joe'       )       expect(test.contact.get 'firstname').to.equal 'joe'         describe "attribute: lastname", ->         "can created valid value", ->           ember.run( ->             test.contact = app.salesrep.createrecord lastname: 'swanson'           )           expect(test.contact.get 'lastname').to.equal 'swanson'           "can not created invalid value", ->           ember.run( ->             test.contact = app.salesrep.createrecord firstname: '123'           )           expect(test.contact.get 'firstname').to.not.equal 'joe'           expect(test.contact.isvalid).to.be.equal false 

the attributes tests passing, expect(test.contact.isvalid).to.be.equal false failing , here error :

    can not created invalid value ‣ assertionerror: expected undefined equal false     @ assertion.assertequal (http://localhost:3500/assets/chai.js:862:12)     @ assertion.ctx.(anonymous function) [as equal] (http://localhost:3500/assets/chai.js:3048:25)     @ context.<anonymous> (http://localhost:3500/assets/app/models/sales_rep_spec.js?body=1:36:51)     @ test.runnable.run (http://localhost:3500/assets/mocha.js:4065:32)     @ runner.runtest (http://localhost:3500/assets/mocha.js:4430:10)     @ http://localhost:3500/assets/mocha.js:4476:12     @ next (http://localhost:3500/assets/mocha.js:4356:14)     @ http://localhost:3500/assets/mocha.js:4365:7     @ next (http://localhost:3500/assets/mocha.js:4313:23)     @ http://localhost:3500/assets/mocha.js:4333:5 

hence new js in general, don't know how solve problem ? test syntax error ?

or should add validation ember model ?

try with:

expect(test.contact.get('isvalid')).to.be.equal false 

basically add .get('isvalid')


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -