diff --git a/addon/-private/system/relationships/ext.js b/addon/-private/system/relationships/ext.js index 872d9f0e1f2..2a8bf05159e 100644 --- a/addon/-private/system/relationships/ext.js +++ b/addon/-private/system/relationships/ext.js @@ -2,7 +2,6 @@ import { A } from '@ember/array'; import { computed } from '@ember/object'; import MapWithDefault from '@ember/map/with-default'; import Map from '@ember/map'; -import Ember from 'ember'; import { assert } from '@ember/debug'; import { typeForRelationshipMeta, @@ -10,10 +9,6 @@ import { } from "../relationship-meta"; export const relationshipsDescriptor = computed(function() { - if (Ember.testing === true && relationshipsDescriptor._cacheable === true) { - relationshipsDescriptor._cacheable = false; - } - let map = new MapWithDefault({ defaultValue() { return []; } }); @@ -37,10 +32,6 @@ export const relationshipsDescriptor = computed(function() { }).readOnly(); export const relatedTypesDescriptor = computed(function() { - if (Ember.testing === true && relatedTypesDescriptor._cacheable === true) { - relatedTypesDescriptor._cacheable = false; - } - let modelName; let types = A(); diff --git a/tests/integration/relationships/belongs-to-test.js b/tests/integration/relationships/belongs-to-test.js index 842aff95feb..f159f4f9002 100644 --- a/tests/integration/relationships/belongs-to-test.js +++ b/tests/integration/relationships/belongs-to-test.js @@ -542,78 +542,6 @@ test("relationshipsByName does not cache a factory", function(assert) { "model factory based on relationship type matches the model based on store.modelFor"); }); -function getDescriptor(object, key) { - var meta = Ember.meta(object); - var mixins = (meta && meta._mixins) || {}; - for (let key in mixins) { - let klass = mixins[key] - if (!klass.properties) { - continue; - } - let descriptor = klass.properties[key]; - if (descriptor) { - return descriptor; - } - } - // Fallback to grabbing the descriptor off of the object for old - // versions of Ember - return object[key]; -} - -test("relationshipsByName is cached in production", function(assert) { - let model = store.modelFor('user'); - let oldTesting = Ember.testing; - //We set the cacheable to true because that is the default state for any CP and then assert that it - //did not get dynamically changed when accessed - let relationshipsByName = getDescriptor(model, 'relationshipsByName'); - let oldCacheable = relationshipsByName._cacheable; - relationshipsByName._cacheable = true; - Ember.testing = false; - try { - assert.equal(get(model, 'relationshipsByName'), get(model, 'relationshipsByName'), 'relationshipsByName are cached'); - assert.equal(get(model, 'relationshipsByName'), get(model, 'relationshipsByName'), 'relationshipsByName are cached'); - } finally { - Ember.testing = oldTesting; - relationshipsByName._cacheable = oldCacheable; - } -}); - -test("relatedTypes is cached in production", function(assert) { - let model = store.modelFor('user'); - let oldTesting = Ember.testing; - //We set the cacheable to true because that is the default state for any CP and then assert that it - //did not get dynamically changed when accessed - let relatedTypes = getDescriptor(model, 'relatedTypes'); - let oldCacheable = relatedTypes._cacheable; - relatedTypes._cacheable = true; - Ember.testing = false; - try { - assert.equal(get(model, 'relatedTypes'), get(model, 'relatedTypes'), 'relatedTypes are cached'); - assert.equal(get(model, 'relatedTypes'), get(model, 'relatedTypes'), 'relatedTypes are cached'); - } finally { - Ember.testing = oldTesting; - relatedTypes._cacheable = oldCacheable; - } -}); - -test("relationships is cached in production", function(assert) { - let model = store.modelFor('user'); - let oldTesting = Ember.testing; - //We set the cacheable to true because that is the default state for any CP and then assert that it - //did not get dynamically changed when accessed - let relationships = getDescriptor(model, 'relationships'); - let oldCacheable = relationships._cacheable; - relationships._cacheable = true; - Ember.testing = false; - try { - assert.equal(get(model, 'relationships'), get(model, 'relationships'), 'relationships are cached'); - assert.equal(get(model, 'relationships'), get(model, 'relationships'), 'relationships are cached'); - } finally { - Ember.testing = oldTesting; - relationships._cacheable = oldCacheable; - } -}); - test("relationship changes shouldn’t cause async fetches", function(assert) { assert.expect(2);