1
- import { mockUseKeyedState } from '@edx/react-unit-test-utils' ;
2
-
3
1
import { reduxHooks } from 'hooks' ;
4
2
import track from 'tracking' ;
3
+ import { MockUseState } from 'testUtils' ;
5
4
6
5
import * as hooks from './hooks' ;
7
6
@@ -19,7 +18,7 @@ reduxHooks.useTrackCourseEvent.mockReturnValue(trackCourseEvent);
19
18
const cardId = 'test-card-id' ;
20
19
let out ;
21
20
22
- const state = mockUseKeyedState ( hooks . stateKeys ) ;
21
+ const state = new MockUseState ( hooks ) ;
23
22
24
23
describe ( 'CourseCardMenu hooks' , ( ) => {
25
24
beforeEach ( ( ) => {
@@ -28,7 +27,6 @@ describe('CourseCardMenu hooks', () => {
28
27
} ) ;
29
28
describe ( 'useUnenrollData' , ( ) => {
30
29
beforeEach ( ( ) => {
31
- state . mockVals ( { isUnenrollConfirmVisible : true } ) ;
32
30
out = hooks . useUnenrollData ( ) ;
33
31
} ) ;
34
32
describe ( 'behavior' , ( ) => {
@@ -37,9 +35,6 @@ describe('CourseCardMenu hooks', () => {
37
35
} ) ;
38
36
} ) ;
39
37
describe ( 'output' , ( ) => {
40
- test ( 'state is loaded from current state value' , ( ) => {
41
- expect ( out . isVisible ) . toEqual ( true ) ;
42
- } ) ;
43
38
test ( 'show sets state value to true' , ( ) => {
44
39
out . show ( ) ;
45
40
expect ( state . setState . isUnenrollConfirmVisible ) . toHaveBeenCalledWith ( true ) ;
@@ -53,7 +48,6 @@ describe('CourseCardMenu hooks', () => {
53
48
54
49
describe ( 'useEmailSettings' , ( ) => {
55
50
beforeEach ( ( ) => {
56
- state . mockVals ( { isEmailSettingsVisible : true } ) ;
57
51
out = hooks . useEmailSettings ( ) ;
58
52
} ) ;
59
53
describe ( 'behavior' , ( ) => {
@@ -62,9 +56,6 @@ describe('CourseCardMenu hooks', () => {
62
56
} ) ;
63
57
} ) ;
64
58
describe ( 'output' , ( ) => {
65
- test ( 'state is loaded from current state value' , ( ) => {
66
- expect ( out . isVisible ) . toEqual ( state . values . isEmailSettingsVisible ) ;
67
- } ) ;
68
59
test ( 'show sets state value to true' , ( ) => {
69
60
out . show ( ) ;
70
61
expect ( state . setState . isEmailSettingsVisible ) . toHaveBeenCalledWith ( true ) ;
0 commit comments