1
1
import { shallow } from "enzyme" ;
2
2
import React from "react" ;
3
- import { collection } from "../TestUtils" ;
3
+ import { collection , container } from "../TestUtils" ;
4
4
import { MaterializedViewComponent } from "./MaterializedViewComponent" ;
5
5
import { MaterializedViewSourceComponent } from "./MaterializedViewSourceComponent" ;
6
6
import { MaterializedViewTargetComponent } from "./MaterializedViewTargetComponent" ;
7
7
8
8
describe ( "MaterializedViewComponent" , ( ) => {
9
9
let testCollection : typeof collection ;
10
+ let testExplorer : typeof container ;
10
11
11
12
beforeEach ( ( ) => {
12
13
testCollection = { ...collection } ;
@@ -18,7 +19,7 @@ describe("MaterializedViewComponent", () => {
18
19
{ id : "view2" , _rid : "rid2" } ,
19
20
] ) ;
20
21
testCollection . materializedViewDefinition ( null ) ;
21
- const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } /> ) ;
22
+ const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } explorer = { testExplorer } /> ) ;
22
23
expect ( wrapper . find ( MaterializedViewSourceComponent ) . exists ( ) ) . toBe ( true ) ;
23
24
expect ( wrapper . find ( MaterializedViewTargetComponent ) . exists ( ) ) . toBe ( false ) ;
24
25
} ) ;
@@ -30,15 +31,15 @@ describe("MaterializedViewComponent", () => {
30
31
sourceCollectionId : "source1" ,
31
32
sourceCollectionRid : "rid123" ,
32
33
} ) ;
33
- const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } /> ) ;
34
+ const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } explorer = { testExplorer } /> ) ;
34
35
expect ( wrapper . find ( MaterializedViewSourceComponent ) . exists ( ) ) . toBe ( false ) ;
35
36
expect ( wrapper . find ( MaterializedViewTargetComponent ) . exists ( ) ) . toBe ( true ) ;
36
37
} ) ;
37
38
38
39
it ( "renders neither component when both are missing" , ( ) => {
39
40
testCollection . materializedViews ( null ) ;
40
41
testCollection . materializedViewDefinition ( null ) ;
41
- const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } /> ) ;
42
+ const wrapper = shallow ( < MaterializedViewComponent collection = { testCollection } explorer = { testExplorer } /> ) ;
42
43
expect ( wrapper . find ( MaterializedViewSourceComponent ) . exists ( ) ) . toBe ( false ) ;
43
44
expect ( wrapper . find ( MaterializedViewTargetComponent ) . exists ( ) ) . toBe ( false ) ;
44
45
} ) ;
0 commit comments