Skip to content

Commit

Permalink
Add failing test case for findAll + unload all
Browse files Browse the repository at this point in the history
  • Loading branch information
raido committed May 9, 2017
1 parent 8091605 commit b1f026e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/integration/records/unload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,27 @@ test("can unload all records for a given type", function(assert) {
assert.equal(env.store.peekRecord('car', 1).get('person.name'), 'Richard II', 'Inverse can load relationship after the record is unloaded');
});

test("can unload all records for a given type + live record array", function(assert) {
env.adapter.findAll = function() {
return Ember.RSVP.Promise.resolve({
data: [{
type: 'boat',
id: 1,
attributes: {
name: 'Yacht'
}
}]
});
};

run(function() {
env.store.findAll('boat').then(() => {
env.store.unloadAll('boat');
assert.equal(env.store.peekAll('boat').get('length'), 0, 'there should be no boat records');
});
});
});

test("can unload all records", function(assert) {
assert.expect(8);

Expand Down

0 comments on commit b1f026e

Please sign in to comment.