@universal-ember/test-support 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/container/get-service.d.ts +3 -0
- package/declarations/container/get-service.d.ts.map +1 -0
- package/declarations/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -1
- package/dist/container/get-service.js +15 -0
- package/dist/container/get-service.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-service.d.ts","sourceRoot":"","sources":["../../src/container/get-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKlE,wBAAgB,UAAU,CAAC,WAAW,SAAS,MAAM,eAAe,EAClE,IAAI,EAAE,WAAW,GAChB,eAAe,CAAC,WAAW,CAAC,CAU9B"}
|
package/declarations/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { assert } from '@ember/debug';
|
|
2
|
+
import { getContext } from '@ember/test-helpers';
|
|
3
|
+
import { getOwner } from '@ember/owner';
|
|
4
|
+
|
|
5
|
+
function getService(name) {
|
|
6
|
+
const context = getContext();
|
|
7
|
+
assert('Could not determine the context for the test', context);
|
|
8
|
+
const owner = context.owner || getOwner(context);
|
|
9
|
+
assert('Could not find the owner on the context', owner);
|
|
10
|
+
const service = owner.lookup(`service:${name}`);
|
|
11
|
+
return service;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getService };
|
|
15
|
+
//# sourceMappingURL=get-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-service.js","sources":["../../src/container/get-service.ts"],"sourcesContent":["import { assert } from '@ember/debug';\nimport type { Registry as ServiceRegistry } from '@ember/service';\nimport { getContext } from '@ember/test-helpers';\nimport { getOwner } from '@ember/owner';\nimport type Owner from '@ember/owner';\n\nexport function getService<ServiceName extends keyof ServiceRegistry>(\n name: ServiceName,\n): ServiceRegistry[ServiceName] {\n const context = getContext() as { owner?: Owner } | undefined;\n assert('Could not determine the context for the test', context);\n\n const owner = context.owner || getOwner(context);\n assert('Could not find the owner on the context', owner);\n\n const service = owner.lookup(`service:${name}`);\n\n return service;\n}\n"],"names":["getService","name","context","getContext","assert","owner","getOwner","service","lookup"],"mappings":";;;;AAMO,SAASA,UAAUA,CACxBC,IAAiB,EACa;AAC9B,EAAA,MAAMC,OAAO,GAAGC,UAAU,EAAmC,CAAA;AAC7DC,EAAAA,MAAM,CAAC,8CAA8C,EAAEF,OAAO,CAAC,CAAA;EAE/D,MAAMG,KAAK,GAAGH,OAAO,CAACG,KAAK,IAAIC,QAAQ,CAACJ,OAAO,CAAC,CAAA;AAChDE,EAAAA,MAAM,CAAC,yCAAyC,EAAEC,KAAK,CAAC,CAAA;EAExD,MAAME,OAAO,GAAGF,KAAK,CAACG,MAAM,CAAE,CAAA,QAAA,EAAUP,IAAK,CAAA,CAAC,CAAC,CAAA;AAE/C,EAAA,OAAOM,OAAO,CAAA;AAChB;;;;"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|