Skip to content

Instantly share code, notes, and snippets.

@ilyakam
Last active November 26, 2016 09:39
Show Gist options
  • Select an option

  • Save ilyakam/4c05e5dbaf3aa4c0234039905749bc0e to your computer and use it in GitHub Desktop.

Select an option

Save ilyakam/4c05e5dbaf3aa4c0234039905749bc0e to your computer and use it in GitHub Desktop.
var someState = {
resolve: {
user: function() {
return 'user_id';
}
}
};
$stateProvider.state(someState);
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