Commit da20ce18114eb5f8e274cb5c1fa17090436e843c
1 parent
9d2ce382
Exists in
master
and in
10 other branches
fixed search tests
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
src/app/search/search-form/search-form.component.spec.ts
@@ -8,7 +8,7 @@ describe("Components", () => { | @@ -8,7 +8,7 @@ describe("Components", () => { | ||
8 | describe("Search Form Component", () => { | 8 | describe("Search Form Component", () => { |
9 | 9 | ||
10 | let helper: ComponentTestHelper<SearchFormComponent>; | 10 | let helper: ComponentTestHelper<SearchFormComponent>; |
11 | - let stateMock = jasmine.createSpyObj("$state", ["go"]); | 11 | + let stateMock = jasmine.createSpyObj("$state", ["go", "params", "current"]); |
12 | 12 | ||
13 | beforeEach(angular.mock.module("templates")); | 13 | beforeEach(angular.mock.module("templates")); |
14 | 14 |
src/app/search/search.component.spec.ts
@@ -12,6 +12,7 @@ describe("Components", () => { | @@ -12,6 +12,7 @@ describe("Components", () => { | ||
12 | let articleService = jasmine.createSpyObj("ArticleService", ["search"]); | 12 | let articleService = jasmine.createSpyObj("ArticleService", ["search"]); |
13 | let result = Promise.resolve({ data: [{ id: 1 }], headers: (param: string) => { return 1; } }); | 13 | let result = Promise.resolve({ data: [{ id: 1 }], headers: (param: string) => { return 1; } }); |
14 | articleService.search = jasmine.createSpy("search").and.returnValue(result); | 14 | articleService.search = jasmine.createSpy("search").and.returnValue(result); |
15 | + let stateMock = jasmine.createSpyObj("$state", ["go"]); | ||
15 | 16 | ||
16 | beforeEach(angular.mock.module("templates")); | 17 | beforeEach(angular.mock.module("templates")); |
17 | 18 | ||
@@ -21,7 +22,8 @@ describe("Components", () => { | @@ -21,7 +22,8 @@ describe("Components", () => { | ||
21 | directives: [SearchComponent], | 22 | directives: [SearchComponent], |
22 | providers: [ | 23 | providers: [ |
23 | helpers.createProviderToValue("$stateParams", stateParams), | 24 | helpers.createProviderToValue("$stateParams", stateParams), |
24 | - helpers.createProviderToValue("ArticleService", articleService) | 25 | + helpers.createProviderToValue("ArticleService", articleService), |
26 | + helpers.createProviderToValue("$state", stateMock), | ||
25 | ].concat(helpers.provideFilters("truncateFilter", "stripTagsFilter")) | 27 | ].concat(helpers.provideFilters("truncateFilter", "stripTagsFilter")) |
26 | }); | 28 | }); |
27 | helper = new ComponentTestHelper<SearchComponent>(cls, done); | 29 | helper = new ComponentTestHelper<SearchComponent>(cls, done); |