Skip to content

Commit

Permalink
Failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
samselikoff committed Jun 22, 2019
1 parent 10f8168 commit 8f6a11b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/mixins/loadable-store/load-records-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { waitUntil } from '@ember/test-helpers';
import MirageServer from 'dummy/tests/integration/helpers/mirage-server';
import { Model, hasMany, belongsTo } from 'ember-cli-mirage';
import LoadableStore from 'ember-data-storefront/mixins/loadable-store';
import DSModel from 'ember-data/model';

module('Integration | Mixins | LoadableStore | loadRecords', function(hooks) {
setupTest(hooks);
Expand Down Expand Up @@ -146,6 +147,27 @@ module('Integration | Mixins | LoadableStore | loadRecords', function(hooks) {
assert.equal(posts.get('firstObject.comments.length'), 2);
});

test('it can load a polymorphic collection with model-specific includes', async function(assert) {
server.logging = true;
this.server.get('/items', schema => {
let posts = schema.posts.all();
let comments = schema.comments.all();

return posts.mergeCollection(comments);
});
let post = this.server.create('post');
let comment = this.server.create('comment');
this.owner.register('model:item', DSModel.extend());

await this.store.loadRecords('item', {
// Only Posts have tags
include: 'tags'
});

assert.ok(this.store.peekRecord('post', post.id));
assert.ok(this.store.peekRecord('comment', comment.id));
});

module('Tracking includes', function() {
test('it will track an include', async function(assert) {
let serverPost = this.server.create('post', { title: 'My post' });
Expand Down

0 comments on commit 8f6a11b

Please sign in to comment.