-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathtagGroup.test.ts
More file actions
120 lines (111 loc) · 3.03 KB
/
Copy pathtagGroup.test.ts
File metadata and controls
120 lines (111 loc) · 3.03 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import * as prettier from "prettier";
import { AllOptions } from "../src/types";
function subject(code: string, options: Partial<AllOptions> = {}) {
return prettier.format(code, {
parser: "babel",
plugins: ["prettier-plugin-jsdoc"],
...options,
} as AllOptions);
}
test("Tag group", async () => {
const result = await subject(
`
/**
* Aliquip ex proident tempor eiusmod aliquip amet. Labore commodo nulla tempor
* consequat exercitation incididunt non. Duis laboris reprehenderit proident
* proident.
* @see {@link http://acme.com}
* @example
* const foo = 0;
* const a = "";
* const b = "";
*
* @param id A test id.
* @throws Minim sit ad commodo ut dolore magna magna minim consequat. Ex
* consequat esse incididunt qui voluptate id voluptate quis ex et. Ullamco
* cillum nisi amet fugiat.
* @return Minim sit a.
*/
`,
{
jsdocSeparateTagGroups: true,
},
);
expect(result).toMatchSnapshot();
});
test("space after unknownTag", async () => {
function _subject(str: string) {
return subject(str, {
arrowParens: "always",
bracketSameLine: false,
bracketSpacing: true,
embeddedLanguageFormatting: "auto",
endOfLine: "lf",
htmlWhitespaceSensitivity: "css",
insertPragma: false,
jsxSingleQuote: true,
printWidth: 180,
proseWrap: "preserve",
quoteProps: "preserve",
requirePragma: false,
semi: true,
singleAttributePerLine: false,
singleQuote: true,
tabWidth: 4,
trailingComma: "all",
useTabs: true,
vueIndentScriptAndStyle: true,
jsdocAddDefaultToDescription: false,
jsdocCapitalizeDescription: true,
jsdocDescriptionTag: false,
jsdocDescriptionWithDot: true,
jsdocKeepUnParseAbleExampleIndent: false,
jsdocLineWrappingStyle: "greedy",
jsdocPreferCodeFences: false,
jsdocPrintWidth: 120,
jsdocSeparateReturnsFromParam: false,
jsdocSeparateTagGroups: true,
jsdocCommentLineStrategy: "multiline",
jsdocSpaces: 1,
jsdocVerticalAlignment: true,
tsdoc: false,
});
}
const result = await _subject(`
/**
*
* A description.
*
* @unknownTag A note.
*
* @see http://acme.com
*/
`);
expect(await _subject(await _subject(result))).toMatchSnapshot();
});
test("Inconsistant formatting", async () => {
const result = await subject(
`
/**
* Aliquip ex proident tempor eiusmod aliquip amet. Labore commodo nulla tempor
* consequat exercitation incididunt non. Duis laboris reprehenderit proident
* proident.
*
* @example
* const foo = 0;
*
*
* @param id A test id.
*
* @throws Minim sit ad commodo ut dolore magna magna minim consequat. Ex
* consequat esse incididunt qui voluptate id voluptate quis ex et. Ullamco
* cillum nisi amet fugiat.
* @see {@link http://acme.com}
*/
`,
{
jsdocSeparateTagGroups: true,
},
);
expect(result).toMatchSnapshot();
});