【发布时间】:2014-10-18 00:17:13
【问题描述】:
我有以下 EmberJS/Konacha 代码。有谁知道为什么测试没有通过?
编辑:
我添加了测试属性值而不是引用的测试用例。
#= require ../spec_helper
describe "Zaptax.v2014.App.AnswersLookup", ->
beforeEach( ->
Test.store = TestUtil.lookupStore()
)
it 'finds the answer by reference', ->
page = Test.store.push Zaptax.v2014.App.PageModel, {id: 666, sequence: 123}
assert.equal Test.store.find('page', 666).get('sequence'), 123
返回:
Failed: Zaptax.v2014.App.AnswersLookup finds the answer by reference
AssertionError: expected undefined to equal 123
【问题讨论】:
-
这很难说,但看起来好像您正在尝试测试两个对象的相等性 - 这将始终返回 false。
-
你认为我可以在哪里寻找任何线索?
-
Test.store.find...至少应该返回PageModel实例,但它返回空白Object () -
@LeszekA 不要忘记
find是异步的并且返回一个promise对象。 -
我使用 localstorage 作为适配器
标签: javascript ember.js ember-data konacha