@@ -27,7 +27,7 @@ describe('Testing componentReducer functionality', function () {
27
27
28
28
// TEST 'ADD CHILD'
29
29
describe ( 'ADD CHILD reducer' , ( ) => {
30
- it ( 'should add child component to top-level component' , ( ) => {
30
+ it ( 'should add child component and separator to top-level component' , ( ) => {
31
31
const action : Action = {
32
32
type : 'ADD CHILD' ,
33
33
payload : {
@@ -40,11 +40,13 @@ describe('Testing componentReducer functionality', function () {
40
40
state . canvasFocus = { componentId : 1 , childId : null } ;
41
41
state = reducer ( state , action ) ;
42
42
const newParent = state . components [ 0 ] ;
43
- // expect new parent's children array to have length 1
44
- expect ( newParent . children . length ) . toEqual ( 1 ) ;
43
+ // expect new parent's children array to have length 2 (component + separator)
44
+ expect ( newParent . children . length ) . toEqual ( 2 ) ;
45
+ // expect first element in children array to be separator
46
+ expect ( newParent . children [ 0 ] . name ) . toEqual ( 'separator' ) ;
45
47
// expect new child to have type 'Component'
46
- expect ( newParent . children [ 0 ] . type ) . toEqual ( 'Component' ) ;
47
- const addedChild = state . components . find ( comp => comp . id === newParent . children [ 0 ] . typeId ) ;
48
+ expect ( newParent . children [ 1 ] . type ) . toEqual ( 'Component' ) ;
49
+ const addedChild = state . components . find ( comp => comp . id === newParent . children [ 1 ] . typeId ) ;
48
50
// expect new child typeId to correspond to component with name 'TestRegular'
49
51
expect ( addedChild . name ) . toEqual ( 'TestRegular' ) ;
50
52
} )
0 commit comments