-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstub-service-test.js
More file actions
36 lines (29 loc) · 964 Bytes
/
stub-service-test.js
File metadata and controls
36 lines (29 loc) · 964 Bytes
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
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { stubService } from "ember-cli-testdouble/test-support";
module("Test Helpers | stub-service", function(hooks) {
setupTest(hooks);
module("as a `hooks` reciever", function(hooks) {
stubService(hooks, "to-stub");
test("it can replace a service", function(assert) {
let service = this.owner.lookup("service:to-stub");
service.method();
assert.verify(service.method());
});
});
module("invoking without `hooks`", function(hooks) {
hooks.beforeEach(function() {
this.service = stubService("to-stub");
});
test("it can replace a service", function(assert) {
let service = this.owner.lookup("service:to-stub");
service.method();
assert.verify(service.method());
assert.equal(
service,
this.service,
"Returns a references to the stubbed service"
);
});
});
});