mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-11 10:09:39 +02:00
Revert "test(config): add temp test for defaultConfig"
This reverts commit 063cb124cd
.
This file was originally added to test whether the new implementation
of the default config in
`packages/mermaid/src/schemas/config.schema.yaml` matched the old
existing default config in `packages/mermaid/src/oldDefaultConfig.ts`,
and this test is no longer needed.
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
import * as configApi from './config.js';
|
import * as configApi from './config.js';
|
||||||
import isObject from 'lodash-es/isObject.js';
|
|
||||||
import type { MermaidConfig } from './config.type.js';
|
|
||||||
|
|
||||||
describe('when working with site config', function () {
|
describe('when working with site config', function () {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -71,43 +69,4 @@ describe('when working with site config', function () {
|
|||||||
const config_4 = configApi.getConfig();
|
const config_4 = configApi.getConfig();
|
||||||
expect(config_4.altFontFamily).toBeUndefined();
|
expect(config_4.altFontFamily).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test new default config', async function () {
|
|
||||||
const { default: oldDefault } = (await import('./oldDefaultConfig.js')) as {
|
|
||||||
default: Required<MermaidConfig>;
|
|
||||||
};
|
|
||||||
// gitGraph used to not have this option (aka it was `undefined`)
|
|
||||||
oldDefault.gitGraph.useMaxWidth = false;
|
|
||||||
|
|
||||||
// class diagrams used to not have these options set (aka they were `undefined`)
|
|
||||||
oldDefault.class.htmlLabels = false;
|
|
||||||
|
|
||||||
const { default: newDefault } = await import('./defaultConfig.js');
|
|
||||||
|
|
||||||
// check subsets of the objects, to improve vitest error messages
|
|
||||||
// we can't just use `expect(newDefault).to.deep.equal(oldDefault);`
|
|
||||||
// because the functions in the config won't be the same
|
|
||||||
expect(new Set(Object.keys(newDefault))).to.deep.equal(new Set(Object.keys(oldDefault)));
|
|
||||||
|
|
||||||
// @ts-ignore: Expect that all the keys in newDefault are valid MermaidConfig keys
|
|
||||||
Object.keys(newDefault).forEach((key: keyof MermaidConfig) => {
|
|
||||||
// recurse through object, since we want to treat functions differently
|
|
||||||
if (!Array.isArray(newDefault[key]) && isObject(newDefault[key])) {
|
|
||||||
expect(new Set(Object.keys(newDefault[key]))).to.deep.equal(
|
|
||||||
new Set(Object.keys(oldDefault[key]))
|
|
||||||
);
|
|
||||||
for (const key2 in newDefault[key]) {
|
|
||||||
if (typeof newDefault[key][key2] === 'function') {
|
|
||||||
expect(newDefault[key][key2].toString()).to.deep.equal(
|
|
||||||
oldDefault[key][key2].toString()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
expect(newDefault[key]).to.have.deep.property(key2, oldDefault[key][key2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
expect(newDefault[key]).to.deep.equal(oldDefault[key]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user