File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable react-hooks/rules-of-hooks */
2
- import { usePlugin } from "@assertive-ts/core" ;
3
- import { SymbolPlugin } from "@examples/symbol-plugin" ;
2
+ // import { usePlugin } from "@assertive-ts/core";
3
+ // import { SymbolPlugin } from "@examples/symbol-plugin";
4
4
import { RootHookObject } from "mocha" ;
5
5
6
6
export function mochaHooks ( ) : RootHookObject {
7
7
return {
8
8
beforeAll ( ) {
9
- usePlugin ( SymbolPlugin ) ;
9
+ // usePlugin(SymbolPlugin);
10
10
} ,
11
11
} ;
12
12
}
Original file line number Diff line number Diff line change
1
+ import { Assertion } from "@assertive-ts/core" ;
2
+ import { ReactTestInstance } from "react-test-renderer" ;
3
+
4
+ export class ElementAssertion extends Assertion < ReactTestInstance > {
5
+ public constructor ( actual : ReactTestInstance ) {
6
+ super ( actual ) ;
7
+ }
8
+
9
+ }
Original file line number Diff line number Diff line change
1
+ import { Plugin } from "@assertive-ts/core" ;
2
+ import { ReactTestInstance } from "react-test-renderer" ;
3
+
4
+ import { ElementAssertion } from "./lib/ElementAssertion" ;
5
+
6
+ declare module "@assertive-ts/core" {
7
+
8
+ export interface Expect {
9
+ // eslint-disable-next-line @typescript-eslint/prefer-function-type
10
+ ( actual : ReactTestInstance ) : ElementAssertion ;
11
+ }
12
+ }
13
+
14
+ const ElementPlugin : Plugin < ReactTestInstance , ElementAssertion > = {
15
+ Assertion : ElementAssertion ,
16
+ insertAt : "top" ,
17
+ predicate : ( actual ) : actual is ReactTestInstance =>
18
+ typeof actual === "object"
19
+ && actual !== null
20
+ && "instance" in actual
21
+ && typeof actual . instance === "object"
22
+ && "type" in actual
23
+ && typeof actual . type === "object"
24
+ && "props" in actual
25
+ && typeof actual . props === "object"
26
+ && "parent" in actual
27
+ && typeof actual . parent === "object"
28
+ && "children" in actual
29
+ && typeof actual . children === "object" ,
30
+ } ;
31
+
32
+ export const NativePlugin = [ ElementPlugin ] ;
You can’t perform that action at this time.
0 commit comments