File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export class ToBeEmptyElementAssertion extends Assertion<ReactTestInstance> {
4040 } ) ;
4141
4242 return this . execute ( {
43- assertWhen : isEmpty ( this . actual ) ,
43+ assertWhen : isEmpty ( this . actual . children ) ,
4444 error,
4545 invertedError,
4646 } ) ;
Original file line number Diff line number Diff line change @@ -14,15 +14,19 @@ export function instanceToString(instance: ReactTestInstance | null): string {
1414 return `<${ instance . type . toString ( ) } ... />` ;
1515}
1616
17- export function isEmpty ( element : ReactTestInstance ) : boolean {
18- const children = element ?. children ;
19-
20- if ( ! children ) {
17+ /**
18+ * Checks if a value is empty.
19+ *
20+ * @param value - The value to check.
21+ * @returns `true` if the value is empty, `false` otherwise.
22+ */
23+ export function isEmpty ( value : unknown ) : boolean {
24+ if ( ! value ) {
2125 return true ;
2226 }
2327
24- if ( Array . isArray ( children ) ) {
25- return children . length === 0 ;
28+ if ( Array . isArray ( value ) ) {
29+ return value . length === 0 ;
2630 }
2731
2832 return false ;
You can’t perform that action at this time.
0 commit comments