File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
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 1
- import { ReactTestInstance } from "react-test-renderer" ;
2
-
3
- export function isEmpty ( element : ReactTestInstance ) : boolean {
4
- const children = element ?. children ;
5
-
6
- if ( ! children ) {
1
+ /**
2
+ * Checks if a value is empty.
3
+ *
4
+ * @param value - The value to check.
5
+ * @returns `true` if the value is empty, `false` otherwise.
6
+ */
7
+ export function isEmpty ( value : unknown ) : boolean {
8
+ if ( ! value ) {
7
9
return true ;
8
10
}
9
11
10
- if ( Array . isArray ( children ) ) {
11
- return children . length === 0 ;
12
+ if ( Array . isArray ( value ) ) {
13
+ return value . length === 0 ;
12
14
}
13
15
14
16
return false ;
You can’t perform that action at this time.
0 commit comments