-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example unit test for spots srvice, run with npm test
remove commented out code remove console.log added to see if function is called
- Loading branch information
John Chen
committed
Feb 24, 2017
1 parent
4045b5a
commit 91fcab1
Showing
6 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { SpotsService } from './spots.service'; | ||
import { AngularFire } from 'angularfire2'; | ||
|
||
describe('when spots service is called', () => { | ||
|
||
it('should call for database value and save it', () => { | ||
let mockAngularFire : any = { | ||
database: { | ||
list : jasmine.createSpy('list').and.returnValue(3) | ||
} | ||
}; | ||
|
||
let serviceToTest = new SpotsService(mockAngularFire as AngularFire); | ||
expect(mockAngularFire.database.list).toHaveBeenCalledTimes(1); | ||
expect(serviceToTest.get()).toEqual(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters