@@ -5,12 +5,11 @@ import { async, ComponentFixture, ComponentFixtureAutoDetect, fakeAsync, TestBed
5
5
import { DashboardModule } from './dashboard.module' ;
6
6
import createSpy = jasmine . createSpy ;
7
7
import { HoverflyService } from '../../shared/services/hoverfly.service' ;
8
- import { NgRedux } from '@angular-redux/store' ;
9
8
import { fromJS } from 'immutable' ;
10
9
import { Subscription } from 'rxjs' ;
11
10
import { By } from '@angular/platform-browser' ;
12
- import { createMockRedux } from '../../shared/testing/redux-helper.spec' ;
13
11
import { click } from '../../shared/testing/click-helper.spec' ;
12
+ import { MockNgRedux , NgReduxTestingModule } from '@angular-redux/store/testing' ;
14
13
15
14
16
15
const mockState : Map < any , any > = fromJS (
@@ -33,26 +32,30 @@ describe('Component: Dashboard', () => {
33
32
let component : DashboardComponent ;
34
33
let fixture : ComponentFixture < DashboardComponent > ;
35
34
36
- const configureTestModule = function ( state : Map < any , any > ) {
35
+ const configureTestModule = function ( ) {
37
36
return TestBed . configureTestingModule ( {
38
37
imports : [
39
- DashboardModule
38
+ DashboardModule ,
39
+ NgReduxTestingModule
40
40
] ,
41
41
providers : [
42
- { provide : NgRedux , useValue : createMockRedux ( state ) } ,
43
42
{ provide : HoverflyService , useClass : MockHoverflyService } ,
44
43
{ provide : ComponentFixtureAutoDetect , useValue : true }
45
44
]
46
45
} )
47
46
. compileComponents ( ) ;
48
47
} ;
49
48
50
- beforeEach ( async ( ( ) => configureTestModule ( mockState ) ) ) ;
49
+ beforeEach ( async ( ( ) => configureTestModule ( ) ) ) ;
51
50
52
51
beforeEach ( ( ) => {
52
+ const hoverflyStub = MockNgRedux . getSelectorStub ( [ 'hoverfly' , 'hoverfly' ] ) ;
53
+ hoverflyStub . next ( mockState ) ;
54
+ hoverflyStub . complete ( ) ;
53
55
fixture = TestBed . createComponent ( DashboardComponent ) ;
54
56
component = fixture . componentInstance ;
55
57
hoverflyService = TestBed . get ( HoverflyService ) ;
58
+ MockNgRedux . reset ( ) ;
56
59
} ) ;
57
60
58
61
it ( 'should create the dashboard' , ( ) => {
@@ -86,7 +89,10 @@ describe('Component: Dashboard', () => {
86
89
}
87
90
} ) ;
88
91
89
- configureTestModule ( stateWithMiddleware ) . then ( ( ) => {
92
+ configureTestModule ( ) . then ( ( ) => {
93
+ const hoverflyStub = MockNgRedux . getSelectorStub ( [ 'hoverfly' , 'hoverfly' ] ) ;
94
+ hoverflyStub . next ( stateWithMiddleware ) ;
95
+ hoverflyStub . complete ( ) ;
90
96
fixture = TestBed . createComponent ( DashboardComponent ) ;
91
97
92
98
const binaryField = fixture . debugElement . query ( By . css ( '#hoverfly-middleware-details-binary code' ) ) ;
@@ -134,7 +140,10 @@ describe('Component: Dashboard', () => {
134
140
}
135
141
} ) ;
136
142
137
- configureTestModule ( stateWithMiddleware ) . then ( ( ) => {
143
+ configureTestModule ( ) . then ( ( ) => {
144
+ const hoverflyStub = MockNgRedux . getSelectorStub ( [ 'hoverfly' , 'hoverfly' ] ) ;
145
+ hoverflyStub . next ( stateWithMiddleware ) ;
146
+ hoverflyStub . complete ( ) ;
138
147
fixture = TestBed . createComponent ( DashboardComponent ) ;
139
148
140
149
const counters = fixture . debugElement . query ( By . css ( '#hoverfly-counters' ) ) ;
0 commit comments