File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { reducer , setXBlockPublishState } from './slice' ;
2
+
3
+ describe ( 'setXBlockPublishState reducer' , ( ) => {
4
+ it ( 'sets published and hasChanges correctly when payload is true' , ( ) => {
5
+ const prevState = {
6
+ courseSectionVertical : {
7
+ xblockInfo : {
8
+ published : false ,
9
+ hasChanges : true ,
10
+ } ,
11
+ } ,
12
+ } ;
13
+ const nextState = reducer ( prevState , setXBlockPublishState ( true ) ) ;
14
+ expect ( nextState . courseSectionVertical . xblockInfo . published ) . toBe ( true ) ;
15
+ expect ( nextState . courseSectionVertical . xblockInfo . hasChanges ) . toBe ( false ) ;
16
+ } ) ;
17
+
18
+ it ( 'sets published and hasChanges correctly when payload is false' , ( ) => {
19
+ const prevState = {
20
+ courseSectionVertical : {
21
+ xblockInfo : {
22
+ published : true ,
23
+ hasChanges : false ,
24
+ } ,
25
+ } ,
26
+ } ;
27
+ const nextState = reducer ( prevState , setXBlockPublishState ( false ) ) ;
28
+ expect ( nextState . courseSectionVertical . xblockInfo . published ) . toBe ( false ) ;
29
+ expect ( nextState . courseSectionVertical . xblockInfo . hasChanges ) . toBe ( true ) ;
30
+ } ) ;
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments