Skip to content

Commit

Permalink
Merge pull request #4621 from emberjs/cleanup-filters
Browse files Browse the repository at this point in the history
tidy-up integration/filter-test
  • Loading branch information
stefanpenner authored Oct 22, 2016
2 parents 44bdeef + bf5dcfa commit b4301d8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/integration/filter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ test('a Record Array can update its filter and notify array observers', function
];
});

store.filter('person', hash => {
return store.filter('person', hash => {
if (hash.get('name').match(/Scumbag [KD]/)) {
return true;
}
}).then(assert.wait(recordArray => {
}).then(recordArray => {

let didChangeIdx;
let didChangeRemoved = 0;
Expand Down Expand Up @@ -381,7 +381,7 @@ test('a Record Array can update its filter and notify array observers', function
assert.equal(recordArray.objectAt(didChangeIdx).get('name'), 'Scumbag Demon');
assert.equal(recordArray.objectAt(didChangeIdx-1).get('name'), 'Scumbag Dale');
});
}));
});
});

test('it is possible to filter by computed properties', function(assert) {
Expand Down Expand Up @@ -440,7 +440,10 @@ test('a filter created after a record is already loaded works', function(assert)
});

assert.equal(filter.get('length'), 1, 'the filter now has a record in it');
assert.asyncEqual(filter.objectAt(0), store.findRecord('person', 1));

return store.findRecord('person', 1).then(person => {
assert.equal(filter.objectAt(0), person);
});
});

test('filter with query persists query on the resulting filteredRecordArray', function(assert) {
Expand Down Expand Up @@ -494,7 +497,7 @@ test('it is possible to filter by state flags', function(assert) {

return person.then(person => {
assert.equal(filter.get('length'), 1, 'the now-loaded record is in the filter');
assert.asyncEqual(filter.objectAt(0), store.findRecord('person', 1));
assert.equal(filter.objectAt(0), person);
});
});

Expand Down Expand Up @@ -586,9 +589,9 @@ test('it is possible to filter created records by isReloading', function(assert)
name: 'Tom Dale'
});

return person.reload().then(assert.wait(person => {
return person.reload().then(person => {
assert.equal(filter.get('length'), 1, 'the filter correctly returned a reloaded object');
}));
});
});

// SERVER SIDE TESTS
Expand Down

0 comments on commit b4301d8

Please sign in to comment.