Skip to content

Commit

Permalink
fixed and simplified test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgame committed Jul 11, 2016
1 parent b45794c commit 3969de4
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions tests/unit/model/relationships/belongs-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,10 @@ test("when response to saving a belongsTo is a success but includes changes that

let user = store.peekRecord('user', '1');

assert.equal(get(user, 'tag.id'), '1', 'confirm local state');

run(function() {
user.set('tag', store.peekRecord('tag', '2'));
});

assert.equal(get(user, 'tag.id'), '2', 'expected local state to reflect the last set');

env.adapter.updateRecord = function() {
return {
type: 'user',
Expand All @@ -209,22 +205,8 @@ test("when response to saving a belongsTo is a success but includes changes that
};

run(function() {
user.save().then(assert.wait(function() {
assert.equal(get(user, 'tag.id'), '1', 'expected new server state to be applied');
}));
});

env.adapter.findRecord = function() {
return {
type: 'user',
id: '1',
tag: { type: 'tag', id: '1' }
};
};

run(function() {
user.reload().then(assert.wait(function() {
assert.equal(get(user, 'tag.id'), '1', 'expected new server state to be applied');
user.save().then(assert.wait(function(user) {
assert.equal(user.get('tag.id'), '1', 'expected new server state to be applied');
}));
});
});
Expand Down

0 comments on commit 3969de4

Please sign in to comment.