0

我有以下 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
4

1 回答 1

1

看起来好像您正在尝试测试两个对象的相等性 - 这将始终返回 false。例如:

var a = {};
var b = {};
assert(a === b); // false

您可能需要做的是检查对象上的属性是否与一系列断言相等。

var a = { name: 'Bob' };
var b = { name: 'Bob' };
assert(a.name === b.name); // true
于 2014-10-17T16:03:06.070 回答