-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix creation recursion with ember-data-model-fragments (#7123)
- Loading branch information
1 parent
bf1afa4
commit 387fc3e
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/-ember-data/tests/integration/store/store-creation-recursion-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { module, test } from 'qunit'; | ||
|
||
import { setupTest } from 'ember-qunit'; | ||
|
||
import Transform from '@ember-data/serializer/transform'; | ||
|
||
module('integration/store/creation-recursion', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('store construction does not construct transforms', function(assert) { | ||
let storeFactory = this.owner.factoryFor('service:store'); | ||
|
||
this.owner.unregister('service:store'); | ||
this.owner.register('service:store', storeFactory); | ||
|
||
let test = this; | ||
test.dateTransformCreated = false; | ||
class MockDateTransform extends Transform { | ||
constructor(...args) { | ||
super(...args); | ||
test.dateTransformCreated = true; | ||
} | ||
} | ||
|
||
this.owner.unregister('transform:date'); | ||
this.owner.register('transform:date', MockDateTransform); | ||
|
||
assert.notOk(this.dateTransformCreated, 'date transform is not yet created'); | ||
|
||
// construct a store - it should now be created | ||
this.owner.lookup('service:store'); | ||
|
||
assert.notOk(this.dateTransformCreated, 'date transform is not yet created'); | ||
|
||
// construct a date transform - it should now be created | ||
this.owner.lookup('transform:date'); | ||
|
||
assert.ok(this.dateTransformCreated, 'date transform is now created'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters