LeszekA
LeszekA

Reputation: 1

Why following test doesn't pass?

I've the following EmberJS/Konacha code. Does anyone have a clue why test doesn't pass ?

EDIT:

I've added test case which tests the attribute value instead of the reference.

#= 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

Returns:

Failed: Zaptax.v2014.App.AnswersLookup finds the answer by reference
  AssertionError: expected undefined to equal 123

Upvotes: 0

Views: 49

Answers (1)

Andy
Andy

Reputation: 63514

It looks as if you're trying to test the equality of two objects - this will always return false. For example:

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

What you'll probably need to do is check that the values of the properties on the objects are equal with a series of assertions instead.

var a = { name: 'Bob' };
var b = { name: 'Bob' };
assert(a.name === b.name); // true

Upvotes: 1

Related Questions