1 |
|
2 | import {CommonWrapper, ShallowWrapper, ReactWrapper} from 'enzyme';
|
3 |
|
4 | export interface Json {
|
5 | type: string;
|
6 | props: {[key: string]: any};
|
7 | children: Array<Json>;
|
8 | $$typeof: Symbol;
|
9 | }
|
10 |
|
11 | export interface OutputMapper {
|
12 | (json: Json): Json;
|
13 | }
|
14 |
|
15 | export interface Options {
|
16 | ignoreDefaultProps?: boolean;
|
17 | map?: OutputMapper;
|
18 | noKey?: boolean;
|
19 | mode?: 'shallow' | 'deep';
|
20 | }
|
21 |
|
22 | export interface JestSerializer {
|
23 | test: (CommonWrapper: CommonWrapper) => boolean;
|
24 | print: (CommonWrapper: CommonWrapper, serializer: JestSerializer) => Json;
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export declare function toJson(wrapper: CommonWrapper | cheerio.Cheerio, options?: Options): Json;
|
33 | export declare function toJson<P, S>(wrapper: CommonWrapper<P, S> | cheerio.Cheerio, options?: Options): Json;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export declare function shallowToJson(wrapper: ShallowWrapper, options?: Options,): Json;
|
41 | export declare function shallowToJson<P, S>(wrapper: ShallowWrapper<P, S>, options?: Options,): Json;
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | export declare function mountToJson(wrapper: ReactWrapper, options?: Options): Json;
|
49 | export declare function mountToJson<P, S>(wrapper: ReactWrapper<P, S>, options?: Options): Json;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | export declare function renderToJson(wrapper: cheerio.Cheerio, options?: Options): Json;
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export declare function createSerializer(options?: Options): JestSerializer;
|
63 |
|
64 | export default toJson;
|