-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistry-test.ts
More file actions
53 lines (40 loc) · 1.31 KB
/
registry-test.ts
File metadata and controls
53 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Registry', function (hooks) {
setupTest(hooks);
test('has the router', function (assert) {
// eslint-disable-next-line ember/no-private-routing-service
const router = this.owner.lookup('router:main');
assert.ok(router);
});
test('has a manually registered service', function (assert) {
const manual = this.owner.lookup('service:manual') as { weDidIt: boolean };
assert.ok(manual);
assert.ok(manual.weDidIt);
});
test('has a manually registered (shorthand) service', function (assert) {
const manual = this.owner.lookup('service:manual-shorthand') as {
weDidIt: boolean;
};
assert.ok(manual);
assert.ok(manual.weDidIt);
});
test('has a service from import.meta.glob', function (assert) {
const metaGlob = this.owner.lookup('service:from-meta-glob') as {
weDidIt: boolean;
};
assert.ok(metaGlob);
assert.ok(metaGlob.weDidIt);
});
test('registered stuff can be looked up', function (assert) {
class Foo {
static create() {
return new this();
}
two = 2;
}
this.owner.register('not-standard:main', Foo);
const value = this.owner.lookup('not-standard:main') as Foo;
assert.strictEqual(value.two, 2);
});
});