Skip to content

Commit

Permalink
Fix ugly test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Dec 3, 2018
1 parent c03c24e commit 708b368
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ describe( 'App', () => {
.root.findAllByType( BlockHolder )
.forEach( ( blockHolder ) => {
if ( 'core/code' === blockHolder.props.name ) {
console.log( BlockHolder.findAllByType );
console.log( BlockHolder.find );
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ];
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
const contentComponent = blockHolderContainer.children[ 0 ];
const inputComponent =
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];

expect( inputComponent.type ).toBe( 'TextInput' );
}
} );
Expand Down

0 comments on commit 708b368

Please sign in to comment.