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> {
40
40
} ) ;
41
41
42
42
return this . execute ( {
43
- assertWhen : isEmpty ( this . actual ) ,
43
+ assertWhen : isEmpty ( this . actual . children ) ,
44
44
error,
45
45
invertedError,
46
46
} ) ;
Original file line number Diff line number Diff line change @@ -14,15 +14,19 @@ export function instanceToString(instance: ReactTestInstance | null): string {
14
14
return `<${ instance . type . toString ( ) } ... />` ;
15
15
}
16
16
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 ) {
21
25
return true ;
22
26
}
23
27
24
- if ( Array . isArray ( children ) ) {
25
- return children . length === 0 ;
28
+ if ( Array . isArray ( value ) ) {
29
+ return value . length === 0 ;
26
30
}
27
31
28
32
return false ;
You can’t perform that action at this time.
0 commit comments