Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE]: eliminate initializer logic not needed after setupStore removed #6448

Merged
merged 14 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions packages/-ember-data/addon/setup-container.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import { DebugAdapter } from './-private';
import Store from '@ember-data/store';

function hasRegistration(application, registrationName) {
// fallback our ember-data tests necessary
// until we kill-off setupStore
// see https://github.com/emberjs/data/issues/6357
// or @ember/test-helpers kills off it's
// legacy support that calls our initializer with registry
// instead of application
if (typeof application.hasRegistration !== 'function') {
return application.has(registrationName);
}
return application.hasRegistration(registrationName);
}
/*
Configures a registry for use with an Ember-Data
store. Accepts an optional namespace argument.
Expand All @@ -21,13 +9,10 @@ function hasRegistration(application, registrationName) {
@param {Ember.Registry} registry
*/
function initializeStore(application) {
// we can just use registerOptionsForType when setupStore is killed
// see https://github.com/emberjs/data/issues/6357
let registerOptionsForType = application.registerOptionsForType || application.optionsForType;
registerOptionsForType.call(application, 'serializer', { singleton: false });
registerOptionsForType.call(application, 'adapter', { singleton: false });
application.registerOptionsForType('serializer', { singleton: false });
application.registerOptionsForType('adapter', { singleton: false });

if (!hasRegistration(application, 'service:store')) {
if (!application.hasRegistration('service:store')) {
application.register('service:store', Store);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/-ember-data/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = function(environment) {
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}

return ENV;
Expand Down
5 changes: 0 additions & 5 deletions packages/-ember-data/tests/helpers/destroy-app.js

This file was deleted.

21 changes: 0 additions & 21 deletions packages/-ember-data/tests/helpers/module-for-acceptance.js

This file was deleted.

12 changes: 0 additions & 12 deletions packages/-ember-data/tests/helpers/owner.js

This file was deleted.

9 changes: 0 additions & 9 deletions packages/-ember-data/tests/helpers/resolver.js

This file was deleted.

19 changes: 0 additions & 19 deletions packages/-ember-data/tests/helpers/start-app.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/-ember-data/tests/integration/application-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module('integration/application - Injecting a Custom Store', function(hooks) {
hooks.beforeEach(function() {
let { owner } = this;

owner.unregister('service:store');
owner.register('service:store', Store.extend({ isCustom: true }));
owner.register('controller:foo', Controller.extend());
owner.register('controller:baz', {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ module('integration/record-data - Custom RecordData Implementations', function(h

owner.register('model:person', Person);
owner.register('model:house', House);
owner.unregister('service:store');
owner.register('service:store', CustomStore);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module('integration/store-wrapper - RecordData StoreWrapper tests', function(hoo
owner.register('model:person', Person);
owner.register('model:house', House);
owner.register('model:car', Car);
owner.unregister('service:store');
owner.register('service:store', CustomStore);
});

Expand Down
9 changes: 4 additions & 5 deletions packages/-ember-data/tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import Application from '../app';
import config from '../config/environment';
import RSVP from 'rsvp';
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';

import QUnit from 'qunit';
import DS from 'ember-data';
import { wait, asyncEqual, invokeAsync } from 'dummy/tests/helpers/async';

// TODO get us to a setApplication world instead
// seems to require killing off createStore
setResolver(resolver);
setApplication(Application.create(config.APP));

const { assert } = QUnit;
const transforms = {
Expand Down