Skip to content

Commit

Permalink
[FEAT links] ensures full links object support for relationships (#6606)
Browse files Browse the repository at this point in the history
* [FEAT links] ensures full links object support for relationships

* fix lint

* add feature flags
  • Loading branch information
runspired authored Oct 25, 2019
1 parent 1a62044 commit 9a67f6a
Show file tree
Hide file tree
Showing 16 changed files with 461 additions and 64 deletions.
2 changes: 1 addition & 1 deletion packages/-build-infra/src/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const requireEsm = require('esm')(module);
function getFeatures() {
const { default: features } = requireEsm('@ember-data/canary-features/addon/default-features.js');
const { default: features } = requireEsm('@ember-data/canary-features/addon/default-features.ts');

const FEATURE_OVERRIDES = process.env.EMBER_DATA_FEATURE_OVERRIDE;
if (FEATURE_OVERRIDES === 'ENABLE_ALL_OPTIONAL') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ module('async has-many rendering tests', function(hooks) {
assert.equal(!!RelationshipPromiseCache['children'], false, 'The relationship has no fetch promise');
assert.equal(!!RelationshipProxyCache['children'], true, 'The relationship has a promise proxy');
assert.equal(relationshipState.hasFailedLoadAttempt === true, true, 'The relationship has attempted a load');
assert.equal(!!relationshipState.link, true, 'The relationship has a link');
assert.equal(!!(relationshipState.links && relationshipState.links.related), true, 'The relationship has a link');

Ember.onerror = originalOnError;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module('integration/adapter/record_persistence - Persisting Records', function(h
this.owner.register('serializer:application', JSONAPISerializer.extend());
});

test("When a store is committed, the adapter's `commit` method should be called with records that have been changed.", function(assert) {
test("When a store is committed, the adapter's `updateRecord` method should be called with records that have been changed.", async function(assert) {
assert.expect(2);

let store = this.owner.lookup('service:store');
Expand All @@ -42,27 +42,18 @@ module('integration/adapter/record_persistence - Persisting Records', function(h
return run(RSVP, 'resolve');
};

run(() => {
store.push({
data: {
type: 'person',
id: '1',
attributes: {
name: 'Braaaahm Dale',
},
const tom = store.push({
data: {
type: 'person',
id: '1',
attributes: {
name: 'Braaaahm Dale',
},
});
},
});

let tom;

return run(() => {
return store.findRecord('person', 1).then(person => {
tom = person;
set(tom, 'name', 'Tom Dale');
return tom.save();
});
});
set(tom, 'name', 'Tom Dale');
await tom.save();
});

test("When a store is committed, the adapter's `commit` method should be called with records that have been created.", function(assert) {
Expand Down
Loading

0 comments on commit 9a67f6a

Please sign in to comment.