Skip to content

Commit

Permalink
chore: refactor: Update test to wait for all promises to be resolved …
Browse files Browse the repository at this point in the history
…and remove duplicated expectation that doesn't seem required
  • Loading branch information
dmuneras committed Nov 10, 2019
1 parent a9b0c7c commit 94cf3b5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/-ember-data/tests/integration/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ module('integration/store - findAll', function(hooks) {
});

test('store#findAll should eventually return all known records even if they are not in the adapter response', async function(assert) {
assert.expect(5);
assert.expect(4);

this.owner.register('model:car', Car);
this.owner.register('adapter:application', RESTAdapter.extend());
Expand Down Expand Up @@ -913,19 +913,15 @@ module('integration/store - findAll', function(hooks) {

assert.equal(cars.length, 2, 'It returns all cars');

let carsInStore = store.peekAll('car');
await settled();

assert.equal(carsInStore.length, 2, 'There is 2 cars in the store');
let carsInStore = store.peekAll('car');

cars = store.peekAll('car');
assert.equal(carsInStore.length, 2, 'There is 2 cars in the store after all promises has been resolved');

let mini = cars.findBy('id', '1');

assert.equal(mini.model, 'New Mini', 'Existing records have been updated');

carsInStore = store.peekAll('car');

assert.equal(carsInStore.length, 2, 'There is 2 cars in the store');
});

test('Using store#fetch on an empty record calls find', async function(assert) {
Expand Down

0 comments on commit 94cf3b5

Please sign in to comment.