Skip to content

Instantly share code, notes, and snippets.

@gdyrrahitis
Last active September 2, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdyrrahitis/699b8cd5d262ed09669d9bc94199ce3c to your computer and use it in GitHub Desktop.
Save gdyrrahitis/699b8cd5d262ed09669d9bc94199ce3c to your computer and use it in GitHub Desktop.
let createComponent: (name: string, locals: any, bindings: any) => any;
let $state: ng.ui.IStateService;
beforeEach(inject((_$componentController_: ng.IComponentControllerService, _$state_) => {
createComponent = (name, locals, bindings) => _$componentController_(name, locals, bindings);
$state = _$state_;
}));
it("should navigate to /todo:id", () => {
// arrange
spyOn($state, "go");
let component = createComponent("todoHome", null, {});
// act
component.showTodo("1");
// assert
expect($state.go).toHaveBeenCalledWith("todo", { id: "1" });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment