File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/react-form-renderer/src/tests/form-renderer Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { mount } from 'enzyme' ;
3
+ import SchemaErrorComponent from '../../form-renderer/schema-error-component' ;
4
+
5
+ describe ( 'schemaErrorComponent' , ( ) => {
6
+ it ( 'renders correctly' , ( ) => {
7
+ const message = 'Error message' ;
8
+ const name = 'Invalid schema :(' ;
9
+
10
+ const wrapper = mount ( < SchemaErrorComponent message = { message } name = { name } /> ) ;
11
+
12
+ expect ( wrapper . find ( 'h1' ) ) . toHaveLength ( 1 ) ;
13
+
14
+ expect ( wrapper . find ( 'h2' ) ) . toHaveLength ( 1 ) ;
15
+ expect ( wrapper . find ( 'h2' ) . text ( ) . includes ( name ) ) . toEqual ( true ) ;
16
+
17
+ expect ( wrapper . find ( 'p' ) ) . toHaveLength ( 2 ) ;
18
+ expect ( wrapper . find ( 'p' ) . first ( ) . text ( ) . includes ( message ) ) . toEqual ( true ) ;
19
+ } ) ;
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments