diff --git a/tests/integration/multiple-stores-test.js b/tests/integration/multiple-stores-test.js index bcf1fd59040..36bdbcf3c83 100644 --- a/tests/integration/multiple-stores-test.js +++ b/tests/integration/multiple-stores-test.js @@ -1,6 +1,7 @@ import { run } from '@ember/runloop'; import setupStore from 'dummy/tests/helpers/store'; import { module, test } from 'qunit'; +import { get } from '@ember/object'; import DS from 'ember-data'; @@ -136,3 +137,27 @@ test("embedded records should be created in multiple stores", function(assert) { assert.equal(env.store_b.hasRecordForId("super-villain", "1"), true, "superVillain should exist in store:store-b"); }); }); + + +test("each store should have a unique instance of the serializers", function(assert) { + env.registry.register('serializer:home-planet', DS.RESTSerializer.extend({})); + + let serializer_a = env.store_a.serializerFor('home-planet'); + let serializer_b = env.store_b.serializerFor('home-planet'); + + assert.equal(get(serializer_a, 'store'), env.store_a); + assert.equal(get(serializer_b, 'store'), env.store_b); + assert.notEqual(serializer_a, serializer_b); +}); + + +test("each store should have a unique instance of the adapters", function(assert) { + env.registry.register('adapter:home-planet', DS.Adapter.extend({})); + + let adapter_a = env.store_a.adapterFor('home-planet'); + let adapter_b = env.store_b.adapterFor('home-planet'); + + assert.equal(get(adapter_a, 'store'), env.store_a); + assert.equal(get(adapter_b, 'store'), env.store_b); + assert.notEqual(adapter_a, adapter_b); +});