-
Notifications
You must be signed in to change notification settings - Fork 605
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
Explicitly lookup session and store services #2306
Explicitly lookup session and store services #2306
Conversation
b8fd72f
to
62810c2
Compare
store.persist({ someOtherKey: 'value' }); // this data will be read again when the event is handled so that no change will be detected | ||
window.dispatchEvent(new StorageEvent('storage', { someOtherKey: store.get('key') })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the keys because it seemed like there are some race conditions with other async tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'd suggest looking into this again – we shouldn't have race conditions in the test suite.
36d5cfd
to
808abc9
Compare
808abc9
to
917ff7a
Compare
sessionService = Session.create({ session }); | ||
setOwner(sessionService, this.owner); | ||
this.owner.register('service:session', sessionService, { instantiate: false }); | ||
session = this.owner.lookup('session:main'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere?
this.owner.register('service:session', sessionService, { instantiate: false }); | ||
session = this.owner.lookup('session:main'); | ||
this.owner.register('service:session', Session); | ||
sessionService = this.owner.lookup('service:session'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere?
this.owner.register('session-store:test', EphemeralStore); | ||
|
||
this.owner.register('session:main', InternalSession); | ||
session = this.owner.lookup('session:main'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere?
sinon = sinonjs.createSandbox(); | ||
|
||
this.owner.register('session-store:test', EphemeralStore); | ||
session = InternalSession.create(this.owner.ownerInjection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
session = InternalSession.create(this.owner.ownerInjection()); | |
session = this.owner.lookup('session:main'); |
not work here?
Ember.testing = true; // eslint-disable-line ember/no-ember-testing-in-module-scope | ||
|
||
this.owner.register('session-store:test', EphemeralStore); | ||
session = InternalSession.create(this.owner.ownerInjection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
session = InternalSession.create(this.owner.ownerInjection()); | |
session = this.owner.lookup('session:main'); |
not work here?
it('looks up the test session store when Ember.testing true', function() { | ||
Ember.testing = true; // eslint-disable-line ember/no-ember-testing-in-module-scope | ||
|
||
this.owner.register('session-store:test', EphemeralStore); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary at all?
Ember.testing = false; // eslint-disable-line ember/no-ember-testing-in-module-scope | ||
sinon = sinonjs.createSandbox(); | ||
|
||
this.owner.register('session-store:test', EphemeralStore); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary at all?
|
||
it('looks up the application session store when Ember.testing false', function() { | ||
Ember.testing = false; // eslint-disable-line ember/no-ember-testing-in-module-scope | ||
sinon = sinonjs.createSandbox(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sinon = sinonjs.createSandbox(); |
The sandbox is already set up in the beforeEach
.
@@ -24,8 +24,11 @@ describe('ApplicationRouteMixin', () => { | |||
beforeEach(function() { | |||
sinon = sinonjs.createSandbox(); | |||
|
|||
session = InternalSession.create({ store: EphemeralStore.create() }); | |||
this.owner.register('session:main', session, { instantiate: false }); | |||
this.owner.register('session-store:test', EphemeralStore); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
this.owner.register('session:main', session, { instantiate: false }); | ||
this.owner.register('session-store:test', EphemeralStore); | ||
|
||
this.owner.register('session:main', InternalSession); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be necessary since it's done in the initializer?
closed in favor of #2315 |
closes #2302