-
-
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.
* feat: improve configurability of json-api builder and request-manager * fix types * add tests * fix prettier * fix forgottend debugger * fixup lint * fix lint
- Loading branch information
Showing
10 changed files
with
158 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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,48 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
import Store from 'ember-data/store'; | ||
import RequestManager from '@ember-data/request'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
module('Integration | Store Extension', function (hooks) { | ||
setupTest(hooks); | ||
|
||
test('We can create a store ', function (assert) { | ||
const { owner } = this; | ||
class CustomStore extends Store {} | ||
owner.register('service:store', CustomStore); | ||
const store = owner.lookup('service:store'); | ||
|
||
assert.true( | ||
store.requestManager instanceof RequestManager, | ||
'We create a request manager for the store automatically' | ||
); | ||
}); | ||
|
||
test('We can create a store with a custom request manager injected as a service', function (assert) { | ||
const { owner } = this; | ||
class CustomStore extends Store { | ||
@service requestManager!: RequestManager; | ||
} | ||
|
||
owner.register('service:store', CustomStore); | ||
owner.register('service:request-manager', RequestManager); | ||
const requestManager = owner.lookup('service:request-manager'); | ||
const store = owner.lookup('service:store'); | ||
|
||
assert.true(store.requestManager === requestManager, 'We can inject a custom request manager into the store'); | ||
}); | ||
|
||
test('We can create a store with a custom request manager initialized as a field', function (assert) { | ||
const { owner } = this; | ||
const requestManager = new RequestManager(); | ||
class CustomStore extends Store { | ||
requestManager = requestManager; | ||
} | ||
|
||
owner.register('service:store', CustomStore); | ||
const store = owner.lookup('service:store'); | ||
|
||
assert.true(store.requestManager === requestManager, 'We can inject a custom request manager into the store'); | ||
}); | ||
}); |