-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathjsdocParserDisable.test.ts
More file actions
57 lines (50 loc) · 1.28 KB
/
Copy pathjsdocParserDisable.test.ts
File metadata and controls
57 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import * as prettier from "prettier";
import { AllOptions } from "../src/types";
function subject(code: string, options: Partial<AllOptions> = {}) {
return prettier.format(code, {
plugins: [],
parser: "babel",
jsdocSpaces: 1,
...options,
} as AllOptions);
}
test("template for callback", async () => {
const result = await subject(`
/**
* @template T
* @callback CallbackName
* @param {GetStyles<T>} getStyles
* @returns {UseStyle<T>}
*/
`);
expect(result).toMatchSnapshot();
});
test("disabled complex object typedef ", async () => {
const result = await subject(`
/**
* The bread crumbs indicate the navigate path and trigger the active page.
* @class
* @typedef {object} props
* @prop {any} navigation
* @extends {PureComponent< props>}
*/
export class BreadCrumbs extends PureComponent {}
`);
expect(result).toMatchSnapshot();
const result2 = await subject(
`
/**
* The bread crumbs indicate the navigate path and trigger the active page.
* @class
* @typedef {object} props
* @prop {any} navigation
* @extends {PureComponent< props>}
*/
export class BreadCrumbs extends PureComponent {}
`,
{
plugins: [],
},
);
expect(result).toBe(result2);
});