Last active
November 26, 2016 09:39
-
-
Save ilyakam/4c05e5dbaf3aa4c0234039905749bc0e 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
| var someState = { | |
| resolve: { | |
| user: function() { | |
| return 'user_id'; | |
| } | |
| } | |
| }; | |
| $stateProvider.state(someState); |
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('ui.router', function($stateProvider) { | |
| $state = $stateProvider; | |
| spyOn($state, 'state'); | |
| })); | |
| beforeEach(function() { | |
| module('some-module'); | |
| inject(); | |
| }) | |
| describe('some state', function() { | |
| it('should resolve the user', function() { | |
| var userTester = { | |
| asymmetricMatch: function(user) { | |
| return user() === 'user_id'; | |
| } | |
| }; | |
| expect($state.state) | |
| .toHaveBeenCalledWith(jasmine.objectContaining({ | |
| resolve: {user: userTester} | |
| })); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment