File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import Label from "../javascript/components/Label" ;
3
+ import { configure } from "enzyme" ;
4
+ import Adapter from "enzyme-adapter-react-16" ;
5
+ import { shallow , mount , render } from "enzyme" ;
6
+ import { Provider } from "react-redux" ;
7
+ import configureStore from "redux-mock-store" ;
8
+
9
+ const mockStore = configureStore ( ) ;
10
+ configure ( { adapter : new Adapter ( ) } ) ;
11
+ let store , wrapper ;
12
+ const initialState = { label : { name : "Expensive Process" , value : 32 } } ;
13
+
14
+ beforeEach ( ( ) => {
15
+ store = mockStore ( initialState ) ;
16
+ wrapper = mount (
17
+ < Provider store = { store } >
18
+ < Label />
19
+ </ Provider >
20
+ ) ;
21
+ } ) ;
22
+
23
+ describe ( "Label is correctly rendered" , ( ) => {
24
+ it ( "Correctly renders name" , ( ) => {
25
+ expect (
26
+ wrapper . contains (
27
+ < span className = "label-name" > { initialState . label . name } </ span >
28
+ )
29
+ ) . toBe ( true ) ;
30
+ } ) ;
31
+ it ( "Correctly renders value" , ( ) => {
32
+ expect (
33
+ wrapper . contains (
34
+ < span className = "label-value" > { initialState . label . value } </ span >
35
+ )
36
+ ) . toBe ( true ) ;
37
+ } ) ;
38
+ } ) ;
You can’t perform that action at this time.
0 commit comments