Last active
November 26, 2016 09:53
-
-
Save ilyakam/553aca6ebfdbfd62ccd76f87d1e687f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $routeProvider | |
| .when('/', { | |
| resolve: { | |
| user: function() { | |
| return 'user_id'; | |
| } | |
| } | |
| }); |
This file contains hidden or 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
| beforeEach(module('ngRoute', function($routeProvider) { | |
| $route = $routeProvider; | |
| spyOn($route, 'when'); | |
| })); | |
| beforeEach(function() { | |
| module('some-module'); | |
| inject(); | |
| }) | |
| describe('some route', function() { | |
| it('should resolve the user', function() { | |
| var userTester = { | |
| asymmetricMatch: function(user) { | |
| return user() === 'user_id'; | |
| } | |
| }; | |
| expect($route.when) | |
| .toHaveBeenCalledWith('/', jasmine.objectContaining({ | |
| resolve: {user: userTester} | |
| })); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment