@cparra/apexdocs 3.0.0-beta.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +246 -650
- package/dist/cli/generate.js +74 -3095
- package/dist/defaults-BcE8DTat.js +13 -0
- package/dist/defaults-D07y_bq4.js +40 -0
- package/dist/defaults-gPzwP66p.js +14 -0
- package/dist/index.d.ts +49 -19
- package/dist/index.js +90 -2
- package/dist/logger-BEbUIfqN.js +3282 -0
- package/dist/logger-BGuf1PnL.js +3281 -0
- package/dist/logger-CWBRF2za.js +3284 -0
- package/dist/logger-CdBmDEN1.js +3283 -0
- package/dist/logger-Ce4QqPFR.js +3278 -0
- package/dist/logger-CyEVYaAC.js +3284 -0
- package/dist/logger-D7a83ycP.js +3277 -0
- package/dist/logger-DGaHeBKk.js +3279 -0
- package/dist/logger-Dqhl_lO_.js +3278 -0
- package/dist/logger-aySSWi0G.js +3280 -0
- package/dist/logger-qLCcAtiy.js +3284 -0
- package/examples/README.md +5 -0
- package/examples/docsify/README.md +17 -0
- package/examples/docsify/apexdocs.config.ts +13 -0
- package/examples/docsify/classes/ASampleClass.cls +57 -0
- package/examples/docsify/classes/CodeControl.cls +19 -0
- package/examples/docsify/classes/SampleClass.cls +95 -0
- package/examples/docsify/classes/SampleInterface.cls +17 -0
- package/examples/docsify/classes/SomeDto.cls +122 -0
- package/examples/docsify/docs/.nojekyll +0 -0
- package/examples/docsify/docs/README.md +25 -0
- package/examples/docsify/docs/_config.yml +1 -0
- package/examples/docsify/docs/index.html +22 -0
- package/examples/docsify/docs/miscellaneous/ASampleClass.md +88 -0
- package/examples/docsify/docs/miscellaneous/CodeControl.md +107 -0
- package/examples/docsify/docs/miscellaneous/SomeDto.md +244 -0
- package/examples/docsify/docs/sample-classes/SampleClass.md +171 -0
- package/examples/docsify/docs/sample-interfaces/SampleInterface.md +36 -0
- package/examples/docsify/package-lock.json +2459 -0
- package/examples/docsify/package.json +14 -0
- package/examples/imported/.forceignore +12 -0
- package/examples/imported/README.md +6 -0
- package/examples/imported/config/project-scratch-def.json +5 -0
- package/examples/imported/docs/index.md +109 -0
- package/examples/imported/docs/miscellaneous/BaseClass.md +13 -0
- package/examples/imported/docs/miscellaneous/MultiInheritanceClass.md +69 -0
- package/examples/imported/docs/miscellaneous/ParentInterface.md +12 -0
- package/examples/imported/docs/miscellaneous/ReferencedEnum.md +5 -0
- package/examples/imported/docs/miscellaneous/SampleException.md +21 -0
- package/examples/imported/docs/miscellaneous/SampleInterface.md +113 -0
- package/examples/imported/docs/miscellaneous/Url.md +308 -0
- package/examples/imported/docs/sample-enums/SampleEnum.md +33 -0
- package/examples/imported/docs/samplegroup/SampleClass.md +167 -0
- package/examples/imported/force-app/classes/BaseClass.cls +3 -0
- package/examples/imported/force-app/classes/MultiInheritanceClass.cls +1 -0
- package/examples/imported/force-app/classes/ParentInterface.cls +3 -0
- package/examples/imported/force-app/classes/ReferencedEnum.cls +3 -0
- package/examples/imported/force-app/classes/SampleInterface.cls +50 -0
- package/examples/imported/force-app/classes/Url.cls +196 -0
- package/examples/imported/package-lock.json +665 -0
- package/examples/imported/package.json +6 -0
- package/examples/imported/scripts/process-docs.mjs +16 -0
- package/examples/imported/sfdx-project.json +12 -0
- package/examples/markdown/README.md +7 -0
- package/examples/markdown/docs/miscellaneous/Url.md +10 -8
- package/examples/markdown/force-app/classes/Url.cls +3 -1
- package/examples/markdown-jsconfig/.forceignore +12 -0
- package/examples/markdown-jsconfig/README.md +9 -0
- package/examples/markdown-jsconfig/apexdocs.config.mjs +22 -0
- package/examples/markdown-jsconfig/config/project-scratch-def.json +5 -0
- package/examples/markdown-jsconfig/docs/index.md +12 -0
- package/examples/markdown-jsconfig/docs/miscellaneous/Url.md +315 -0
- package/examples/markdown-jsconfig/force-app/classes/Url.cls +196 -0
- package/examples/markdown-jsconfig/package-lock.json +665 -0
- package/examples/markdown-jsconfig/package.json +15 -0
- package/examples/markdown-jsconfig/sfdx-project.json +12 -0
- package/examples/open-api/README.md +5 -0
- package/examples/open-api/docs/openapi.json +2 -570
- package/examples/vitepress/README.md +25 -0
- package/examples/vitepress/apexdocs.config.ts +9 -2
- package/examples/vitepress/docs/index.md +11 -11
- package/examples/vitepress/docs/miscellaneous/BaseClass.md +1 -1
- package/examples/vitepress/docs/miscellaneous/MultiInheritanceClass.md +2 -2
- package/examples/vitepress/docs/miscellaneous/SampleException.md +1 -1
- package/examples/vitepress/docs/miscellaneous/SampleInterface.md +6 -6
- package/examples/vitepress/docs/miscellaneous/Url.md +3 -3
- package/examples/vitepress/docs/sample-enums/SampleEnum.md +3 -3
- package/examples/vitepress/docs/samplegroup/SampleClass.md +5 -5
- package/examples/vitepress/force-app/main/default/classes/feature-a/SampleClass.cls +73 -0
- package/examples/vitepress/force-app/main/default/classes/feature-a/SampleEnum.cls +30 -0
- package/examples/vitepress/force-app/main/default/classes/feature-a/SampleException.cls +17 -0
- package/package.json +3 -3
- package/src/application/Apexdocs.ts +16 -19
- package/src/application/__tests__/apex-file-reader.spec.ts +108 -67
- package/src/application/apex-file-reader.ts +1 -0
- package/src/application/generators/openapi.ts +17 -13
- package/src/cli/args.ts +12 -3
- package/src/cli/commands/markdown.ts +15 -12
- package/src/cli/commands/openapi.ts +5 -5
- package/src/cli/generate.ts +20 -4
- package/src/core/markdown/__test__/generating-class-docs.spec.ts +15 -386
- package/src/core/markdown/__test__/generating-docs.spec.ts +378 -0
- package/src/core/markdown/__test__/generating-enum-docs.spec.ts +4 -328
- package/src/core/markdown/__test__/generating-interface-docs.spec.ts +4 -296
- package/src/core/markdown/__test__/generating-reference-guide.spec.ts +17 -1
- package/src/core/markdown/__test__/test-helpers.ts +3 -1
- package/src/core/markdown/adapters/__tests__/interface-adapter.spec.ts +3 -1
- package/src/core/markdown/adapters/renderable-to-page-data.ts +6 -4
- package/src/core/markdown/generate-docs.ts +13 -15
- package/src/core/markdown/reflection/__test__/filter-scope.spec.ts +290 -0
- package/src/core/markdown/reflection/__test__/helpers.ts +18 -0
- package/src/core/markdown/reflection/__test__/remove-excluded-tags.spec.ts +200 -0
- package/src/core/markdown/reflection/remove-excluded-tags.ts +168 -0
- package/src/core/markdown/reflection/{sort-members.ts → sort-types-and-members.ts} +7 -5
- package/src/core/markdown/templates/reference-guide.ts +2 -2
- package/src/core/openapi/__tests__/open-api-docs-processor.spec.ts +6 -3
- package/src/core/openapi/open-api-docs-processor.ts +3 -3
- package/src/core/openapi/parser.ts +5 -2
- package/src/core/shared/types.d.ts +18 -18
- package/src/defaults.ts +15 -3
- package/src/index.ts +88 -14
- package/src/util/error-logger.ts +36 -36
- package/src/util/logger.ts +18 -11
- /package/examples/{vitepress/force-app/main/default → imported/force-app}/classes/SampleClass.cls +0 -0
- /package/examples/{vitepress/force-app/main/default → imported/force-app}/classes/SampleEnum.cls +0 -0
- /package/examples/{vitepress/force-app/main/default → imported/force-app}/classes/SampleException.cls +0 -0
- /package/examples/vitepress/force-app/main/default/classes/{SampleInterface.cls → feature-a/SampleInterface.cls} +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { DocPageData, PostHookDocumentationBundle } from '../../shared/types';
|
|
2
|
+
import { assertEither, extendExpect } from './expect-extensions';
|
|
3
|
+
import { apexBundleFromRawString, generateDocs } from './test-helpers';
|
|
4
|
+
|
|
5
|
+
function aSingleDoc(result: PostHookDocumentationBundle): DocPageData {
|
|
6
|
+
expect(result.docs).toHaveLength(1);
|
|
7
|
+
return result.docs[0];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe('When generating documentation', () => {
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
extendExpect();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('the resulting files', () => {
|
|
16
|
+
it('are named after the type', async () => {
|
|
17
|
+
const properties: [string, string][] = [
|
|
18
|
+
['public class MyClass {}', 'MyClass.md'],
|
|
19
|
+
['public interface MyInterface {}', 'MyInterface.md'],
|
|
20
|
+
['public enum MyEnum {}', 'MyEnum.md'],
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
for (const [input, expected] of properties) {
|
|
24
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
25
|
+
assertEither(result, (data) => expect(aSingleDoc(data).outputDocPath).toContain(expected));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('are placed in the miscellaneous folder if no group is provided', async () => {
|
|
30
|
+
const properties: [string, string][] = [
|
|
31
|
+
['public class MyClass {}', 'miscellaneous'],
|
|
32
|
+
['public interface MyInterface {}', 'miscellaneous'],
|
|
33
|
+
['public enum MyEnum {}', 'miscellaneous'],
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
for (const [input, expected] of properties) {
|
|
37
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
38
|
+
assertEither(result, (data) => expect(aSingleDoc(data).outputDocPath).toContain(expected));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('are placed in the slugified group folder if a group is provided', async () => {
|
|
43
|
+
const properties: [string, string][] = [
|
|
44
|
+
[
|
|
45
|
+
`/**
|
|
46
|
+
* @group MyGroup
|
|
47
|
+
*/
|
|
48
|
+
public class MyClass {}`,
|
|
49
|
+
'mygroup',
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
`/**
|
|
53
|
+
* @group MyGroup
|
|
54
|
+
*/
|
|
55
|
+
public interface MyInterface {}`,
|
|
56
|
+
'mygroup',
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
`/**
|
|
60
|
+
* @group MyGroup
|
|
61
|
+
*/
|
|
62
|
+
public enum MyEnum {}`,
|
|
63
|
+
'mygroup',
|
|
64
|
+
],
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
for (const [input, expected] of properties) {
|
|
68
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
69
|
+
assertEither(result, (data) => expect(aSingleDoc(data).outputDocPath).toContain(expected));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('the generated bundles', () => {
|
|
75
|
+
it('return the type', async () => {
|
|
76
|
+
const properties: [string, string][] = [
|
|
77
|
+
['public class MyClass {}', 'class'],
|
|
78
|
+
['public interface MyInterface {}', 'interface'],
|
|
79
|
+
['public enum MyEnum {}', 'enum'],
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
for (const [input, expected] of properties) {
|
|
83
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
84
|
+
assertEither(result, (data) => expect(aSingleDoc(data).source.type).toBe(expected));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('do not return files out of scope', async () => {
|
|
89
|
+
const input1 = 'global class MyClass {}';
|
|
90
|
+
const input2 = 'public class AnotherClass {}';
|
|
91
|
+
|
|
92
|
+
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)], {
|
|
93
|
+
scope: ['global'],
|
|
94
|
+
})();
|
|
95
|
+
expect(result).documentationBundleHasLength(1);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('do not return files that have an @ignore in the docs', async () => {
|
|
99
|
+
const input = `
|
|
100
|
+
/**
|
|
101
|
+
* @ignore
|
|
102
|
+
*/
|
|
103
|
+
public class MyClass {}`;
|
|
104
|
+
|
|
105
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
106
|
+
expect(result).documentationBundleHasLength(0);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('the documentation content', () => {
|
|
111
|
+
it('includes a heading with the type name', async () => {
|
|
112
|
+
const properties: [string, string][] = [
|
|
113
|
+
['public class MyClass {}', 'MyClass Class'],
|
|
114
|
+
['public enum MyEnum {}', 'MyEnum Enum'],
|
|
115
|
+
['public interface MyInterface {}', 'MyInterface Interface'],
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
for (const [input, expected] of properties) {
|
|
119
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
120
|
+
|
|
121
|
+
expect(result).documentationBundleHasLength(1);
|
|
122
|
+
assertEither(result, (data) => expect(data).firstDocContains(expected));
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('displays type level annotations', async () => {
|
|
127
|
+
const input = `
|
|
128
|
+
@NamespaceAccessible
|
|
129
|
+
public class MyClass {
|
|
130
|
+
@Deprecated
|
|
131
|
+
public void myMethod() {}
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
136
|
+
|
|
137
|
+
expect(result).documentationBundleHasLength(1);
|
|
138
|
+
assertEither(result, (data) => expect(data).firstDocContains('NAMESPACEACCESSIBLE'));
|
|
139
|
+
assertEither(result, (data) => expect(data).firstDocContains('DEPRECATED'));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('displays metadata as annotations', async () => {
|
|
143
|
+
const input = 'public class MyClass {}';
|
|
144
|
+
const metadata = `
|
|
145
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
146
|
+
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
147
|
+
<apiVersion>59.0</apiVersion>
|
|
148
|
+
<status>Active</status>
|
|
149
|
+
</ApexClass>
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
const result = await generateDocs([apexBundleFromRawString(input, metadata)])();
|
|
153
|
+
|
|
154
|
+
expect(result).documentationBundleHasLength(1);
|
|
155
|
+
assertEither(result, (data) => expect(data).firstDocContains('APIVERSION'));
|
|
156
|
+
assertEither(result, (data) => expect(data).firstDocContains('STATUS'));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('displays the description when no @description tag is used', async () => {
|
|
160
|
+
const input = `
|
|
161
|
+
/**
|
|
162
|
+
* This is a description
|
|
163
|
+
*/
|
|
164
|
+
public class MyClass {}
|
|
165
|
+
`;
|
|
166
|
+
|
|
167
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
168
|
+
|
|
169
|
+
expect(result).documentationBundleHasLength(1);
|
|
170
|
+
assertEither(result, (data) => expect(data).firstDocContains('This is a description'));
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('displays the description when a @description tag is used', async () => {
|
|
174
|
+
const input = `
|
|
175
|
+
/**
|
|
176
|
+
* @description This is a description
|
|
177
|
+
*/
|
|
178
|
+
public class MyClass {}`;
|
|
179
|
+
|
|
180
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
181
|
+
expect(result).documentationBundleHasLength(1);
|
|
182
|
+
assertEither(result, (data) => expect(data).firstDocContains('This is a description'));
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('display custom documentation tags', async () => {
|
|
186
|
+
const input = `
|
|
187
|
+
/**
|
|
188
|
+
* @custom-tag My Value
|
|
189
|
+
*/
|
|
190
|
+
public class MyClass {}
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
194
|
+
expect(result).documentationBundleHasLength(1);
|
|
195
|
+
assertEither(result, (data) => expect(data).firstDocContains('Custom Tag'));
|
|
196
|
+
assertEither(result, (data) => expect(data).firstDocContains('My Value'));
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('displays the group', async () => {
|
|
200
|
+
const input = `
|
|
201
|
+
/**
|
|
202
|
+
* @group MyGroup
|
|
203
|
+
*/
|
|
204
|
+
public class MyClass {}`;
|
|
205
|
+
|
|
206
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
207
|
+
expect(result).documentationBundleHasLength(1);
|
|
208
|
+
assertEither(result, (data) => expect(data).firstDocContains('Group'));
|
|
209
|
+
assertEither(result, (data) => expect(data).firstDocContains('MyGroup'));
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('displays the author', async () => {
|
|
213
|
+
const input = `
|
|
214
|
+
/**
|
|
215
|
+
* @author John Doe
|
|
216
|
+
*/
|
|
217
|
+
public class MyClass {}`;
|
|
218
|
+
|
|
219
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
220
|
+
expect(result).documentationBundleHasLength(1);
|
|
221
|
+
assertEither(result, (data) => expect(data).firstDocContains('Author'));
|
|
222
|
+
assertEither(result, (data) => expect(data).firstDocContains('John Doe'));
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('displays the date', async () => {
|
|
226
|
+
const input = `
|
|
227
|
+
/**
|
|
228
|
+
* @date 2021-01-01
|
|
229
|
+
*/
|
|
230
|
+
public class MyClass {}`;
|
|
231
|
+
|
|
232
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
233
|
+
expect(result).documentationBundleHasLength(1);
|
|
234
|
+
assertEither(result, (data) => expect(data).firstDocContains('Date'));
|
|
235
|
+
assertEither(result, (data) => expect(data).firstDocContains('2021-01-01'));
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('displays descriptions with links', async () => {
|
|
239
|
+
const input1 = `
|
|
240
|
+
/**
|
|
241
|
+
* @description This is a description with a {@link ClassRef} reference
|
|
242
|
+
*/
|
|
243
|
+
public enum MyClass {}
|
|
244
|
+
`;
|
|
245
|
+
|
|
246
|
+
const input2 = 'public class ClassRef {}';
|
|
247
|
+
|
|
248
|
+
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)])();
|
|
249
|
+
expect(result).documentationBundleHasLength(2);
|
|
250
|
+
assertEither(result, (data) =>
|
|
251
|
+
expect(data).firstDocContains('This is a description with a [ClassRef](ClassRef.md) reference'),
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('displays descriptions with emails', async () => {
|
|
256
|
+
const input = `
|
|
257
|
+
/**
|
|
258
|
+
* @description This is a description with an {@email test@testerson.com} email
|
|
259
|
+
*/
|
|
260
|
+
public class MyClass {}
|
|
261
|
+
`;
|
|
262
|
+
|
|
263
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
264
|
+
expect(result).documentationBundleHasLength(1);
|
|
265
|
+
assertEither(result, (data) =>
|
|
266
|
+
expect(data).firstDocContains(
|
|
267
|
+
'This is a description with an [test@testerson.com](mailto:test@testerson.com) email',
|
|
268
|
+
),
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('displays @sees with accurately resolved links', async () => {
|
|
273
|
+
const input1 = `
|
|
274
|
+
/**
|
|
275
|
+
* @see ClassRef
|
|
276
|
+
*/
|
|
277
|
+
public class MyClass {}
|
|
278
|
+
`;
|
|
279
|
+
|
|
280
|
+
const input2 = 'public class ClassRef {}';
|
|
281
|
+
|
|
282
|
+
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)])();
|
|
283
|
+
expect(result).documentationBundleHasLength(2);
|
|
284
|
+
assertEither(result, (data) => expect(data).firstDocContains('See'));
|
|
285
|
+
assertEither(result, (data) => expect(data).firstDocContains('[ClassRef](ClassRef.md)'));
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it('displays @sees without links when the reference is not found', async () => {
|
|
289
|
+
const input = `
|
|
290
|
+
/**
|
|
291
|
+
* @see ClassRef
|
|
292
|
+
*/
|
|
293
|
+
public class MyClass {}
|
|
294
|
+
`;
|
|
295
|
+
|
|
296
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
297
|
+
|
|
298
|
+
expect(result).documentationBundleHasLength(1);
|
|
299
|
+
assertEither(result, (data) => expect(data).firstDocContains('See'));
|
|
300
|
+
assertEither(result, (data) => expect(data).firstDocContains('ClassRef'));
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('displays the namespace if present in the config', async () => {
|
|
304
|
+
const input = 'public class MyClass {}';
|
|
305
|
+
|
|
306
|
+
const result = await generateDocs([apexBundleFromRawString(input)], { namespace: 'MyNamespace' })();
|
|
307
|
+
expect(result).documentationBundleHasLength(1);
|
|
308
|
+
assertEither(result, (data) => expect(data).firstDocContains('## Namespace'));
|
|
309
|
+
assertEither(result, (data) => expect(data).firstDocContains('MyNamespace'));
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('does not display the namespace if not present in the config', async () => {
|
|
313
|
+
const input = 'public class MyClass {}';
|
|
314
|
+
|
|
315
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
316
|
+
expect(result).documentationBundleHasLength(1);
|
|
317
|
+
assertEither(result, (data) => expect(data).firstDocContainsNot('## Namespace'));
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('displays a mermaid diagram', async () => {
|
|
321
|
+
const input = `
|
|
322
|
+
/**
|
|
323
|
+
* @mermaid
|
|
324
|
+
* \`\`\`mermaid
|
|
325
|
+
* graph TD
|
|
326
|
+
* A[Square Rect] -- Link text --> B((Circle))
|
|
327
|
+
* A --> C(Round Rect)
|
|
328
|
+
* B --> D{Rhombus}
|
|
329
|
+
* C --> D
|
|
330
|
+
* \`\`\`
|
|
331
|
+
*/
|
|
332
|
+
public class MyClass {}
|
|
333
|
+
`;
|
|
334
|
+
|
|
335
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
336
|
+
expect(result).documentationBundleHasLength(1);
|
|
337
|
+
assertEither(result, (data) => expect(data).firstDocContains('```mermaid'));
|
|
338
|
+
assertEither(result, (data) => expect(data).firstDocContains('graph TD'));
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('displays an example code block', async () => {
|
|
342
|
+
const input = `
|
|
343
|
+
/**
|
|
344
|
+
* @example
|
|
345
|
+
* \`\`\`apex
|
|
346
|
+
* public class MyClass {
|
|
347
|
+
* public void myMethod() {
|
|
348
|
+
* System.debug('Hello, World!');
|
|
349
|
+
* }
|
|
350
|
+
* }
|
|
351
|
+
* \`\`\`
|
|
352
|
+
*/
|
|
353
|
+
public class MyClass {}`;
|
|
354
|
+
|
|
355
|
+
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
356
|
+
|
|
357
|
+
expect(result).documentationBundleHasLength(1);
|
|
358
|
+
assertEither(result, (data) => expect(data).firstDocContains('```apex'));
|
|
359
|
+
assertEither(result, (data) => expect(data).firstDocContains('public class MyClass'));
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it('does not display tags marked as excluded', async () => {
|
|
363
|
+
const input = `
|
|
364
|
+
/**
|
|
365
|
+
* @see ClassRef
|
|
366
|
+
*/
|
|
367
|
+
public class MyClass {}
|
|
368
|
+
`;
|
|
369
|
+
|
|
370
|
+
const result = await generateDocs([apexBundleFromRawString(input)], {
|
|
371
|
+
excludeTags: ['see'],
|
|
372
|
+
})();
|
|
373
|
+
|
|
374
|
+
expect(result).documentationBundleHasLength(1);
|
|
375
|
+
assertEither(result, (data) => expect(data).firstDocContainsNot('See'));
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
});
|