@cparra/apexdocs 3.0.0-rc.0 → 3.1.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/README.md +61 -576
- package/dist/cli/generate.js +73 -3094
- 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 +35 -3
- 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/package.json +5 -2
- package/.github/workflows/ci.yaml +0 -22
- package/.github/workflows/close_stale.yml +0 -22
- package/.prettierrc.js +0 -7
- package/__mocks__/chalk.js +0 -12
- package/__mocks__/log-update.js +0 -6
- package/eslint.config.mjs +0 -10
- package/examples/markdown/.forceignore +0 -12
- package/examples/markdown/config/project-scratch-def.json +0 -5
- package/examples/markdown/docs/index.md +0 -109
- package/examples/markdown/docs/miscellaneous/BaseClass.md +0 -16
- package/examples/markdown/docs/miscellaneous/MultiInheritanceClass.md +0 -72
- package/examples/markdown/docs/miscellaneous/ParentInterface.md +0 -15
- package/examples/markdown/docs/miscellaneous/ReferencedEnum.md +0 -8
- package/examples/markdown/docs/miscellaneous/SampleException.md +0 -24
- package/examples/markdown/docs/miscellaneous/SampleInterface.md +0 -116
- package/examples/markdown/docs/miscellaneous/Url.md +0 -311
- package/examples/markdown/docs/sample-enums/SampleEnum.md +0 -36
- package/examples/markdown/docs/samplegroup/SampleClass.md +0 -170
- package/examples/markdown/force-app/classes/BaseClass.cls +0 -3
- package/examples/markdown/force-app/classes/MultiInheritanceClass.cls +0 -1
- package/examples/markdown/force-app/classes/ParentInterface.cls +0 -3
- package/examples/markdown/force-app/classes/ReferencedEnum.cls +0 -3
- package/examples/markdown/force-app/classes/SampleClass.cls +0 -72
- package/examples/markdown/force-app/classes/SampleEnum.cls +0 -30
- package/examples/markdown/force-app/classes/SampleException.cls +0 -17
- package/examples/markdown/force-app/classes/SampleInterface.cls +0 -50
- package/examples/markdown/force-app/classes/Url.cls +0 -196
- package/examples/markdown/package-lock.json +0 -665
- package/examples/markdown/package.json +0 -20
- package/examples/markdown/sfdx-project.json +0 -12
- package/examples/markdown-jsconfig/.forceignore +0 -12
- package/examples/markdown-jsconfig/apexdocs.config.mjs +0 -21
- package/examples/markdown-jsconfig/config/project-scratch-def.json +0 -5
- package/examples/markdown-jsconfig/docs/index.md +0 -12
- package/examples/markdown-jsconfig/docs/miscellaneous/Url.md +0 -315
- package/examples/markdown-jsconfig/force-app/classes/Url.cls +0 -196
- package/examples/markdown-jsconfig/package-lock.json +0 -665
- package/examples/markdown-jsconfig/package.json +0 -15
- package/examples/markdown-jsconfig/sfdx-project.json +0 -12
- package/examples/open-api/config/project-scratch-def.json +0 -13
- package/examples/open-api/docs/openapi.json +0 -582
- package/examples/open-api/force-app/main/default/classes/ChildClass.cls +0 -42
- package/examples/open-api/force-app/main/default/classes/SampleClass.cls +0 -167
- package/examples/open-api/force-app/main/default/restapi/SampleRestResource.cls +0 -195
- package/examples/open-api/force-app/main/default/restapi/SampleRestResourceToSkip.cls +0 -35
- package/examples/open-api/force-app/main/default/restapi/SampleRestResourceWithInnerClass.cls +0 -24
- package/examples/open-api/force-app/main/default/restapi/SampleRestResourceWithoutApexDocs.cls +0 -15
- package/examples/open-api/force-app/main/default/restapi/references/Reference1.cls +0 -9
- package/examples/open-api/force-app/main/default/restapi/references/Reference2.cls +0 -9
- package/examples/open-api/force-app/main/default/restapi/references/Reference3.cls +0 -3
- package/examples/open-api/force-app/main/default/restapi/references/Reference4.cls +0 -3
- package/examples/open-api/force-app/main/default/restapi/references/Reference5.cls +0 -3
- package/examples/open-api/force-app/main/default/restapi/references/Reference6.cls +0 -6
- package/examples/open-api/force-app/main/default/restapi/references/Reference7.cls +0 -3
- package/examples/open-api/package-lock.json +0 -724
- package/examples/open-api/package.json +0 -20
- package/examples/open-api/sfdx-project.json +0 -12
- package/examples/vitepress/.forceignore +0 -12
- package/examples/vitepress/apexdocs.config.ts +0 -111
- package/examples/vitepress/config/project-scratch-def.json +0 -13
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js +0 -259
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/cache/deps/_metadata.json +0 -40
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js +0 -11474
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js +0 -9172
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/cache/deps/package.json +0 -3
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4339
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -567
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js +0 -323
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js.map +0 -7
- package/examples/vitepress/docs/.vitepress/config.mts +0 -21
- package/examples/vitepress/docs/.vitepress/sidebar.json +0 -119
- package/examples/vitepress/docs/api-examples.md +0 -49
- package/examples/vitepress/docs/index-frontmatter.md +0 -16
- package/examples/vitepress/docs/index.md +0 -56
- package/examples/vitepress/docs/markdown-examples.md +0 -85
- package/examples/vitepress/docs/miscellaneous/BaseClass.md +0 -20
- package/examples/vitepress/docs/miscellaneous/MultiInheritanceClass.md +0 -76
- package/examples/vitepress/docs/miscellaneous/ParentInterface.md +0 -19
- package/examples/vitepress/docs/miscellaneous/ReferencedEnum.md +0 -15
- package/examples/vitepress/docs/miscellaneous/SampleException.md +0 -28
- package/examples/vitepress/docs/miscellaneous/SampleInterface.md +0 -116
- package/examples/vitepress/docs/miscellaneous/Url.md +0 -317
- package/examples/vitepress/docs/sample-enums/SampleEnum.md +0 -40
- package/examples/vitepress/docs/samplegroup/SampleClass.md +0 -174
- package/examples/vitepress/force-app/main/default/classes/BaseClass.cls +0 -3
- package/examples/vitepress/force-app/main/default/classes/MultiInheritanceClass.cls +0 -1
- package/examples/vitepress/force-app/main/default/classes/ParentInterface.cls +0 -3
- package/examples/vitepress/force-app/main/default/classes/ReferencedEnum.cls +0 -5
- package/examples/vitepress/force-app/main/default/classes/SampleClass.cls +0 -72
- package/examples/vitepress/force-app/main/default/classes/SampleEnum.cls +0 -30
- package/examples/vitepress/force-app/main/default/classes/SampleException.cls +0 -17
- package/examples/vitepress/force-app/main/default/classes/SampleInterface.cls +0 -46
- package/examples/vitepress/force-app/main/default/classes/Url.cls +0 -198
- package/examples/vitepress/package-lock.json +0 -2574
- package/examples/vitepress/package.json +0 -18
- package/examples/vitepress/sfdx-project.json +0 -12
- package/jest.config.js +0 -10
- package/jest.d.ts +0 -7
- package/src/application/Apexdocs.ts +0 -72
- package/src/application/__tests__/apex-file-reader.spec.ts +0 -87
- package/src/application/apex-file-reader.ts +0 -55
- package/src/application/file-system.ts +0 -69
- package/src/application/file-writer.ts +0 -43
- package/src/application/generators/markdown.ts +0 -45
- package/src/application/generators/openapi.ts +0 -71
- package/src/cli/args.ts +0 -46
- package/src/cli/commands/markdown.ts +0 -51
- package/src/cli/commands/openapi.ts +0 -36
- package/src/cli/generate.ts +0 -16
- package/src/core/__test__/manifest.spec.ts +0 -16
- package/src/core/manifest.ts +0 -90
- package/src/core/markdown/__test__/expect-extensions.ts +0 -32
- package/src/core/markdown/__test__/generating-class-docs.spec.ts +0 -605
- package/src/core/markdown/__test__/generating-docs.spec.ts +0 -111
- package/src/core/markdown/__test__/generating-enum-docs.spec.ts +0 -321
- package/src/core/markdown/__test__/generating-interface-docs.spec.ts +0 -397
- package/src/core/markdown/__test__/generating-reference-guide.spec.ts +0 -180
- package/src/core/markdown/__test__/inheritance-chain.test.ts +0 -54
- package/src/core/markdown/__test__/test-helpers.ts +0 -23
- package/src/core/markdown/adapters/__tests__/documentables.spec.ts +0 -109
- package/src/core/markdown/adapters/__tests__/interface-adapter.spec.ts +0 -148
- package/src/core/markdown/adapters/__tests__/link-generator.spec.ts +0 -130
- package/src/core/markdown/adapters/__tests__/references.spec.ts +0 -136
- package/src/core/markdown/adapters/apex-types.ts +0 -238
- package/src/core/markdown/adapters/documentables.ts +0 -115
- package/src/core/markdown/adapters/fields-and-properties.ts +0 -45
- package/src/core/markdown/adapters/generate-link.ts +0 -82
- package/src/core/markdown/adapters/inline.ts +0 -143
- package/src/core/markdown/adapters/methods-and-constructors.ts +0 -133
- package/src/core/markdown/adapters/reference-guide.ts +0 -37
- package/src/core/markdown/adapters/renderable-bundle.ts +0 -61
- package/src/core/markdown/adapters/renderable-to-page-data.ts +0 -89
- package/src/core/markdown/adapters/type-utils.ts +0 -13
- package/src/core/markdown/adapters/types.d.ts +0 -180
- package/src/core/markdown/generate-docs.ts +0 -212
- package/src/core/markdown/reflection/__test__/filter-scope.spec.ts +0 -306
- package/src/core/markdown/reflection/filter-scope.ts +0 -13
- package/src/core/markdown/reflection/inheritance-chain-expanion.ts +0 -22
- package/src/core/markdown/reflection/inheritance-chain.ts +0 -23
- package/src/core/markdown/reflection/inherited-member-expansion.ts +0 -105
- package/src/core/markdown/reflection/reflect-source.ts +0 -123
- package/src/core/markdown/reflection/sort-members.ts +0 -59
- package/src/core/markdown/templates/class-template.ts +0 -75
- package/src/core/markdown/templates/constructors-partial-template.ts +0 -32
- package/src/core/markdown/templates/documentable-partial-template.ts +0 -26
- package/src/core/markdown/templates/enum-template.ts +0 -12
- package/src/core/markdown/templates/fieldsPartialTemplate.ts +0 -23
- package/src/core/markdown/templates/grouped-members-partial-template.ts +0 -6
- package/src/core/markdown/templates/hookable.ts +0 -7
- package/src/core/markdown/templates/interface-template.ts +0 -16
- package/src/core/markdown/templates/methods-partial-template.ts +0 -43
- package/src/core/markdown/templates/reference-guide.ts +0 -14
- package/src/core/markdown/templates/template.ts +0 -114
- package/src/core/markdown/templates/type-doc-partial.ts +0 -27
- package/src/core/markdown/utils.ts +0 -3
- package/src/core/openApiSettings.ts +0 -41
- package/src/core/openapi/__tests__/manifest-factory.spec.ts +0 -16
- package/src/core/openapi/__tests__/open-api-docs-processor.spec.ts +0 -56
- package/src/core/openapi/__tests__/open-api.spec.ts +0 -22
- package/src/core/openapi/apex-doc-types.ts +0 -26
- package/src/core/openapi/apex-type-wrappers/ClassMirrorWrapper.ts +0 -12
- package/src/core/openapi/apex-type-wrappers/MethodMirrorWrapper.ts +0 -11
- package/src/core/openapi/apex-type-wrappers/__tests__/ClassMirrorWrapper.spec.ts +0 -15
- package/src/core/openapi/file-container.ts +0 -13
- package/src/core/openapi/manifest-factory.ts +0 -16
- package/src/core/openapi/open-api-docs-processor.ts +0 -93
- package/src/core/openapi/open-api-types.ts +0 -119
- package/src/core/openapi/open-api.ts +0 -45
- package/src/core/openapi/openapi-type-file.ts +0 -12
- package/src/core/openapi/parser.ts +0 -160
- package/src/core/openapi/parsers/Builder.ts +0 -40
- package/src/core/openapi/parsers/MethodParser.ts +0 -249
- package/src/core/openapi/parsers/ParameterObjectBuilder.ts +0 -13
- package/src/core/openapi/parsers/ReferenceBuilder.ts +0 -299
- package/src/core/openapi/parsers/RequestBodyBuilder.ts +0 -19
- package/src/core/openapi/parsers/ResponsesBuilder.ts +0 -21
- package/src/core/openapi/parsers/__tests__/MethodParser.spec.ts +0 -44
- package/src/core/openapi/parsers/__tests__/ParameterObjectBuilder.spec.ts +0 -68
- package/src/core/openapi/parsers/__tests__/ReferenceBuilder.spec.ts +0 -751
- package/src/core/openapi/parsers/__tests__/RequestBodyBuilder.spec.ts +0 -64
- package/src/core/openapi/parsers/__tests__/ResponsesBuilder.spec.ts +0 -55
- package/src/core/openapi/transpiler.ts +0 -17
- package/src/core/openapi/types-repository.ts +0 -54
- package/src/core/parse-apex-metadata.ts +0 -30
- package/src/core/shared/types.d.ts +0 -148
- package/src/core/shared/utils.ts +0 -5
- package/src/defaults.ts +0 -9
- package/src/index.ts +0 -49
- package/src/test-helpers/AnnotationBuilder.ts +0 -29
- package/src/test-helpers/ClassMirrorBuilder.ts +0 -69
- package/src/test-helpers/DocCommentAnnotationBuilder.ts +0 -24
- package/src/test-helpers/DocCommentBuilder.ts +0 -36
- package/src/test-helpers/FieldMirrorBuilder.ts +0 -59
- package/src/test-helpers/InterfaceMirrorBuilder.ts +0 -39
- package/src/test-helpers/MethodMirrorBuilder.ts +0 -77
- package/src/test-helpers/SettingsBuilder.ts +0 -17
- package/src/util/error-logger.ts +0 -92
- package/src/util/fp.ts +0 -3
- package/src/util/logger.ts +0 -44
- package/src/util/string-utils.ts +0 -7
- package/tsconfig.json +0 -25
- package/tslint.json +0 -6
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
|
|
89
|
-
describe('the generated bundle', () => {
|
|
90
|
-
it('does not return files out of scope', async () => {
|
|
91
|
-
const input1 = 'global class MyClass {}';
|
|
92
|
-
const input2 = 'public class AnotherClass {}';
|
|
93
|
-
|
|
94
|
-
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)], {
|
|
95
|
-
scope: ['global'],
|
|
96
|
-
})();
|
|
97
|
-
expect(result).documentationBundleHasLength(1);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('does not return files that have an @ignore in the docs', async () => {
|
|
101
|
-
const input = `
|
|
102
|
-
/**
|
|
103
|
-
* @ignore
|
|
104
|
-
*/
|
|
105
|
-
public class MyClass {}`;
|
|
106
|
-
|
|
107
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
108
|
-
expect(result).documentationBundleHasLength(0);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { assertEither, extendExpect } from './expect-extensions';
|
|
2
|
-
import { apexBundleFromRawString, generateDocs } from './test-helpers';
|
|
3
|
-
|
|
4
|
-
describe('Generates enum documentation', () => {
|
|
5
|
-
beforeAll(() => {
|
|
6
|
-
extendExpect();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
describe('documentation content', () => {
|
|
10
|
-
it('generates a heading with the enum name', async () => {
|
|
11
|
-
const input = `
|
|
12
|
-
public enum MyEnum {
|
|
13
|
-
VALUE1,
|
|
14
|
-
VALUE2
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
const output = `# MyEnum Enum`;
|
|
19
|
-
|
|
20
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
21
|
-
expect(result).documentationBundleHasLength(1);
|
|
22
|
-
assertEither(result, (data) => expect(data).firstDocContains(output));
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('displays type level annotations', async () => {
|
|
26
|
-
const input = `
|
|
27
|
-
@NamespaceAccessible
|
|
28
|
-
public enum MyEnum {
|
|
29
|
-
VALUE1,
|
|
30
|
-
VALUE2
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
35
|
-
expect(result).documentationBundleHasLength(1);
|
|
36
|
-
assertEither(result, (data) => expect(data).firstDocContains('NAMESPACEACCESSIBLE'));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('displays the description', async () => {
|
|
40
|
-
const input = `
|
|
41
|
-
/**
|
|
42
|
-
* This is a description
|
|
43
|
-
*/
|
|
44
|
-
public enum MyEnum {
|
|
45
|
-
VALUE1,
|
|
46
|
-
VALUE2
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
51
|
-
expect(result).documentationBundleHasLength(1);
|
|
52
|
-
assertEither(result, (data) => expect(data).firstDocContains('This is a description'));
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('display custom documentation tags', async () => {
|
|
56
|
-
const input = `
|
|
57
|
-
/**
|
|
58
|
-
* @custom-tag My Value
|
|
59
|
-
*/
|
|
60
|
-
public enum MyEnum {
|
|
61
|
-
VALUE1,
|
|
62
|
-
VALUE2
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
67
|
-
expect(result).documentationBundleHasLength(1);
|
|
68
|
-
assertEither(result, (data) => expect(data).firstDocContains('Custom Tag'));
|
|
69
|
-
assertEither(result, (data) => expect(data).firstDocContains('My Value'));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('displays the group', async () => {
|
|
73
|
-
const input = `
|
|
74
|
-
/**
|
|
75
|
-
* @group MyGroup
|
|
76
|
-
*/
|
|
77
|
-
public enum MyEnum {
|
|
78
|
-
VALUE1,
|
|
79
|
-
VALUE2
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
84
|
-
expect(result).documentationBundleHasLength(1);
|
|
85
|
-
assertEither(result, (data) => expect(data).firstDocContains('Group'));
|
|
86
|
-
assertEither(result, (data) => expect(data).firstDocContains('MyGroup'));
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('displays the author', async () => {
|
|
90
|
-
const input = `
|
|
91
|
-
/**
|
|
92
|
-
* @author John Doe
|
|
93
|
-
*/
|
|
94
|
-
public enum MyEnum {
|
|
95
|
-
VALUE1,
|
|
96
|
-
VALUE2
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
|
|
100
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
101
|
-
expect(result).documentationBundleHasLength(1);
|
|
102
|
-
assertEither(result, (data) => expect(data).firstDocContains('Author'));
|
|
103
|
-
assertEither(result, (data) => expect(data).firstDocContains('John Doe'));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('displays the date', async () => {
|
|
107
|
-
const input = `
|
|
108
|
-
/**
|
|
109
|
-
* @date 2021-01-01
|
|
110
|
-
*/
|
|
111
|
-
public enum MyEnum {
|
|
112
|
-
VALUE1,
|
|
113
|
-
VALUE2
|
|
114
|
-
}
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
118
|
-
expect(result).documentationBundleHasLength(1);
|
|
119
|
-
assertEither(result, (data) => expect(data).firstDocContains('Date'));
|
|
120
|
-
assertEither(result, (data) => expect(data).firstDocContains('2021-01-01'));
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('displays descriptions', async () => {
|
|
124
|
-
const input = `
|
|
125
|
-
/**
|
|
126
|
-
* @description This is a description
|
|
127
|
-
*/
|
|
128
|
-
public enum MyEnum {}
|
|
129
|
-
`;
|
|
130
|
-
|
|
131
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
132
|
-
expect(result).documentationBundleHasLength(1);
|
|
133
|
-
assertEither(result, (data) => expect(data).firstDocContains('This is a description'));
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('displays descriptions with links', async () => {
|
|
137
|
-
const input1 = `
|
|
138
|
-
/**
|
|
139
|
-
* @description This is a description with a {@link EnumRef} reference
|
|
140
|
-
*/
|
|
141
|
-
public enum MyEnum {}
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
const input2 = 'public enum EnumRef {}';
|
|
145
|
-
|
|
146
|
-
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)])();
|
|
147
|
-
expect(result).documentationBundleHasLength(2);
|
|
148
|
-
assertEither(result, (data) => expect(data).firstDocContains('Description'));
|
|
149
|
-
assertEither(result, (data) =>
|
|
150
|
-
expect(data).firstDocContains('This is a description with a [EnumRef](EnumRef.md) reference'),
|
|
151
|
-
);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('displays descriptions with emails', async () => {
|
|
155
|
-
const input = `
|
|
156
|
-
/**
|
|
157
|
-
* @description This is a description with an {@email test@testerson.com} email
|
|
158
|
-
*/
|
|
159
|
-
public enum MyEnum {}
|
|
160
|
-
`;
|
|
161
|
-
|
|
162
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
163
|
-
expect(result).documentationBundleHasLength(1);
|
|
164
|
-
assertEither(result, (data) =>
|
|
165
|
-
expect(data).firstDocContains(
|
|
166
|
-
'This is a description with an [test@testerson.com](mailto:test@testerson.com) email',
|
|
167
|
-
),
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('displays sees with accurately resolved links', async () => {
|
|
172
|
-
const input1 = `
|
|
173
|
-
/**
|
|
174
|
-
* @see EnumRef
|
|
175
|
-
*/
|
|
176
|
-
public enum MyEnum {}
|
|
177
|
-
`;
|
|
178
|
-
|
|
179
|
-
const input2 = 'public enum EnumRef {}';
|
|
180
|
-
|
|
181
|
-
const result = await generateDocs([apexBundleFromRawString(input1), apexBundleFromRawString(input2)])();
|
|
182
|
-
expect(result).documentationBundleHasLength(2);
|
|
183
|
-
assertEither(result, (data) => expect(data).firstDocContains('See'));
|
|
184
|
-
assertEither(result, (data) => expect(data).firstDocContains('[EnumRef](EnumRef.md)'));
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('displays sees without links when the reference is not found', async () => {
|
|
188
|
-
const input = `
|
|
189
|
-
/**
|
|
190
|
-
* @see EnumRef
|
|
191
|
-
*/
|
|
192
|
-
public enum MyEnum {}
|
|
193
|
-
`;
|
|
194
|
-
|
|
195
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
196
|
-
expect(result).documentationBundleHasLength(1);
|
|
197
|
-
assertEither(result, (data) => expect(data).firstDocContains('See'));
|
|
198
|
-
assertEither(result, (data) => expect(data).firstDocContains('EnumRef'));
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('displays the namespace if present in the config', async () => {
|
|
202
|
-
const input = `
|
|
203
|
-
public enum MyEnum {}
|
|
204
|
-
`;
|
|
205
|
-
|
|
206
|
-
const result = await generateDocs([apexBundleFromRawString(input)], { namespace: 'MyNamespace' })();
|
|
207
|
-
expect(result).documentationBundleHasLength(1);
|
|
208
|
-
assertEither(result, (data) => expect(data).firstDocContains('## Namespace'));
|
|
209
|
-
assertEither(result, (data) => expect(data).firstDocContains('MyNamespace'));
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it('does not display the namespace if not present in the config', async () => {
|
|
213
|
-
const input = `
|
|
214
|
-
public enum MyEnum {}
|
|
215
|
-
`;
|
|
216
|
-
|
|
217
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
218
|
-
expect(result).documentationBundleHasLength(1);
|
|
219
|
-
assertEither(result, (data) => expect(data).firstDocContainsNot('## Namespace'));
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('displays a mermaid diagram', async () => {
|
|
223
|
-
const input = `
|
|
224
|
-
/**
|
|
225
|
-
* @mermaid
|
|
226
|
-
* \`\`\`mermaid
|
|
227
|
-
* graph TD
|
|
228
|
-
* A[Square Rect] -- Link text --> B((Circle))
|
|
229
|
-
* A --> C(Round Rect)
|
|
230
|
-
* B --> D{Rhombus}
|
|
231
|
-
* C --> D
|
|
232
|
-
* \`\`\`
|
|
233
|
-
*/
|
|
234
|
-
public enum MyEnum {
|
|
235
|
-
VALUE1,
|
|
236
|
-
VALUE2
|
|
237
|
-
}
|
|
238
|
-
`;
|
|
239
|
-
|
|
240
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
241
|
-
expect(result).documentationBundleHasLength(1);
|
|
242
|
-
assertEither(result, (data) => expect(data).firstDocContains('```mermaid'));
|
|
243
|
-
assertEither(result, (data) => expect(data).firstDocContains('graph TD'));
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('displays an example code block', async () => {
|
|
247
|
-
const input = `
|
|
248
|
-
/**
|
|
249
|
-
* @example
|
|
250
|
-
* \`\`\`apex
|
|
251
|
-
* public class MyClass {
|
|
252
|
-
* public void myMethod() {
|
|
253
|
-
* System.debug('Hello, World!');
|
|
254
|
-
* }
|
|
255
|
-
* }
|
|
256
|
-
* \`\`\`
|
|
257
|
-
*/
|
|
258
|
-
public enum MyEnum {
|
|
259
|
-
VALUE1,
|
|
260
|
-
VALUE2
|
|
261
|
-
}
|
|
262
|
-
`;
|
|
263
|
-
|
|
264
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
265
|
-
expect(result).documentationBundleHasLength(1);
|
|
266
|
-
assertEither(result, (data) => expect(data).firstDocContains('```apex'));
|
|
267
|
-
assertEither(result, (data) => expect(data).firstDocContains('public class MyClass'));
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it('displays values', async () => {
|
|
271
|
-
const input = `
|
|
272
|
-
public enum MyEnum {
|
|
273
|
-
VALUE1,
|
|
274
|
-
VALUE2
|
|
275
|
-
}
|
|
276
|
-
`;
|
|
277
|
-
|
|
278
|
-
const result = await generateDocs([apexBundleFromRawString(input)])();
|
|
279
|
-
expect(result).documentationBundleHasLength(1);
|
|
280
|
-
assertEither(result, (data) => expect(data).firstDocContains('## Values'));
|
|
281
|
-
assertEither(result, (data) => expect(data).firstDocContains('VALUE1'));
|
|
282
|
-
assertEither(result, (data) => expect(data).firstDocContains('VALUE2'));
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it('displays values sorted when sortMembersAlphabetically is true', async () => {
|
|
286
|
-
const input = `
|
|
287
|
-
public enum MyEnum {
|
|
288
|
-
VALUE2,
|
|
289
|
-
VALUE1
|
|
290
|
-
}
|
|
291
|
-
`;
|
|
292
|
-
|
|
293
|
-
const result = await generateDocs([apexBundleFromRawString(input)], { sortMembersAlphabetically: true })();
|
|
294
|
-
expect(result).documentationBundleHasLength(1);
|
|
295
|
-
assertEither(result, (data) => expect(data).firstDocContains('## Values'));
|
|
296
|
-
assertEither(result, (data) => {
|
|
297
|
-
const value1Index = data.docs[0].content.indexOf('VALUE1');
|
|
298
|
-
const value2Index = data.docs[0].content.indexOf('VALUE2');
|
|
299
|
-
expect(value1Index).toBeLessThan(value2Index);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
it('does not sort values when sortMembersAlphabetically is false', async () => {
|
|
304
|
-
const input = `
|
|
305
|
-
public enum MyEnum {
|
|
306
|
-
VALUE2,
|
|
307
|
-
VALUE1
|
|
308
|
-
}
|
|
309
|
-
`;
|
|
310
|
-
|
|
311
|
-
const result = await generateDocs([apexBundleFromRawString(input)], { sortMembersAlphabetically: false })();
|
|
312
|
-
expect(result).documentationBundleHasLength(1);
|
|
313
|
-
assertEither(result, (data) => expect(data).firstDocContains('## Values'));
|
|
314
|
-
assertEither(result, (data) => {
|
|
315
|
-
const value1Index = data.docs[0].content.indexOf('VALUE1');
|
|
316
|
-
const value2Index = data.docs[0].content.indexOf('VALUE2');
|
|
317
|
-
expect(value1Index).toBeGreaterThan(value2Index);
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
});
|