Skip to content

Commit 1ba2ef7

Browse files
mansonasivakumar-kailasam
authored andcommitted
Services: change to stubMapUtil and need to restart test server for unit tests
1 parent c18b8c5 commit 1ba2ef7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

guides/v3.1.0/tutorial/service.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,11 @@ You may now either move onto the [next feature](../subroutes/), or continue here
243243
We'll use a unit test to validate the service.
244244
Unit tests are more isolated than integration tests and application tests,
245245
and are intended for testing specific logic within a class.
246+
(Note: you should restart `ember test --server` whenever you add a new service, otherwise the new service will not be available to your unit tests).
246247

247248
For our service unit test, we'll want to verify that locations that have been previously loaded are fetched from cache, while new locations are created using the utility.
248249
We will isolate our tests from actually calling Google Maps by stubbing our map utility.
249-
On line 6 of `maps-test.js` below we create an Ember object to simulate the behavior of the utility, but instead of creating a google map, we return an empty JavaScript object.
250+
On line 19 of `maps-test.js` below we create a Javascript object to simulate the behavior of the utility, but instead of creating a google map, we return an empty JavaScript object.
250251

251252
To instantiate the service, we can instantiate it through ember's resolver using the [`factoryFor`](https://emberjs.com/api/ember/release/classes/ApplicationInstance/methods/factoryFor?anchor=factoryFor) method.
252253
`factoryFor` allows us to have control over the creation of the service in Ember, to pass arguments to the constructor that can override parts of the service for our tests.

0 commit comments

Comments
 (0)