@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.
@@ -0,0 +1,3 @@
1
+ import type { Registry as ServiceRegistry } from '@ember/service';
2
+ export declare function getService<ServiceName extends keyof ServiceRegistry>(name: ServiceName): ServiceRegistry[ServiceName];
3
+ //# sourceMappingURL=get-service.d.ts.map
@@ -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"}
@@ -1,2 +1,3 @@
1
1
  export { visitAllLinks } from './routing/visit-all.ts';
2
+ export { getService } from './container/get-service.ts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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
@@ -1,2 +1,3 @@
1
1
  export { visitAllLinks } from './routing/visit-all.js';
2
+ export { getService } from './container/get-service.js';
2
3
  //# sourceMappingURL=index.js.map
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":";"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-ember/test-support",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "The default blueprint for Embroider v2 addons.",
5
5
  "keywords": [
6
6
  "ember-addon"