@@ -78,21 +78,40 @@ describe('app selectors unit tests', () => {
78
78
} ) ;
79
79
} ) ;
80
80
describe ( 'isInitialized selector' , ( ) => {
81
- it ( 'is memoized based on editorInitialized and blockValue' , ( ) => {
81
+ it ( 'is memoized based on editorInitialized, unitUrl, isLibrary and blockValue' , ( ) => {
82
82
expect ( selectors . isInitialized . preSelectors ) . toEqual ( [
83
+ simpleSelectors . unitUrl ,
83
84
simpleSelectors . blockValue ,
85
+ selectors . isLibrary ,
84
86
] ) ;
85
87
} ) ;
86
- it ( 'returns true iff blockValue and editorInitialized are truthy' , ( ) => {
87
- const { cb } = selectors . isInitialized ;
88
- const truthy = {
89
- blockValue : { block : 'value' } ,
90
- } ;
88
+ describe ( 'for library blocks' , ( ) => {
89
+ it ( 'returns true if blockValue, and editorInitialized are truthy' , ( ) => {
90
+ const { cb } = selectors . isInitialized ;
91
+ const truthy = {
92
+ blockValue : { block : 'value' } ,
93
+ } ;
91
94
92
- [
93
- [ [ truthy . blockValue ] , true ] ,
94
- [ [ null ] , false ] ,
95
- ] . map ( ( [ args , expected ] ) => expect ( cb ( ...args ) ) . toEqual ( expected ) ) ;
95
+ [
96
+ [ [ null , truthy . blockValue , true ] , true ] ,
97
+ [ [ null , null , true ] , false ] ,
98
+ ] . map ( ( [ args , expected ] ) => expect ( cb ( ...args ) ) . toEqual ( expected ) ) ;
99
+ } ) ;
100
+ } ) ;
101
+ describe ( 'for course blocks' , ( ) => {
102
+ it ( 'returns true if blockValue, unitUrl, and editorInitialized are truthy' , ( ) => {
103
+ const { cb } = selectors . isInitialized ;
104
+ const truthy = {
105
+ blockValue : { block : 'value' } ,
106
+ unitUrl : { url : 'data' } ,
107
+ } ;
108
+
109
+ [
110
+ [ [ null , truthy . blockValue , false ] , false ] ,
111
+ [ [ truthy . unitUrl , null , false ] , false ] ,
112
+ [ [ truthy . unitUrl , truthy . blockValue , false ] , true ] ,
113
+ ] . map ( ( [ args , expected ] ) => expect ( cb ( ...args ) ) . toEqual ( expected ) ) ;
114
+ } ) ;
96
115
} ) ;
97
116
} ) ;
98
117
describe ( 'displayTitle' , ( ) => {
0 commit comments