test(techdocs-node): sequence node custom tag validation failure

This test proves that currently only scalar YAML nodes are considered valid by
the mkdocs YAML validation logic, even though using the `!ENV` tag with
sequential data is officially supported by mkdocs[0].

[0] https://www.mkdocs.org/user-guide/configuration/#environment-variables

Signed-off-by: Viktor Bahr <viktor.bahr@tier.app>
This commit is contained in:
Viktor Bahr
2022-04-14 17:44:08 +02:00
parent 240f96eac3
commit b7b2899e55
2 changed files with 11 additions and 1 deletions
@@ -0,0 +1 @@
site_name: !ENV [SITE_NAME, OTHER_NAME, 'My default site name']
@@ -78,6 +78,9 @@ const mkdocsYmlWithoutPlugins = fs.readFileSync(
const mkdocsYmlWithAdditionalPlugins = fs.readFileSync(
resolvePath(__filename, '../__fixtures__/mkdocs_with_additional_plugins.yml'),
);
const mkdocsYmlWithEnvTag = fs.readFileSync(
resolvePath(__filename, '../__fixtures__/mkdocs_with_env_tag.yml'),
);
const mockLogger = getVoidLogger();
const warn = jest.spyOn(mockLogger, 'warn');
@@ -582,10 +585,16 @@ describe('helpers', () => {
).rejects.toThrow();
});
it('should validate files with custom yaml tags', async () => {
it('should validate files with custom yaml tags (scalar)', async () => {
await expect(
validateMkdocsYaml(inputDir, mkdocsYmlWithExtensions.toString()),
).resolves.toBeUndefined();
});
it('should validate files with custom yaml tags (sequence)', async () => {
await expect(
validateMkdocsYaml(inputDir, mkdocsYmlWithEnvTag.toString()),
).resolves.toBeUndefined();
});
});
});