mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix tests
This commit is contained in:
parent
2855df5776
commit
38a71a6f07
3 changed files with 13 additions and 10 deletions
|
@ -4,6 +4,7 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
import {fromPartial} from '@total-typescript/shoehorn';
|
||||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||||
import type {Options} from '@docusaurus/plugin-content-showcase';
|
import type {Options} from '@docusaurus/plugin-content-showcase';
|
||||||
|
@ -101,7 +102,7 @@ describe('normalizeShowcasePluginOptions', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(testValidate(userOptions)).toEqual({
|
expect(testValidate(fromPartial(userOptions))).toEqual({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
...userOptions,
|
...userOptions,
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {fromPartial} from '@total-typescript/shoehorn';
|
||||||
import {getTagsList} from '../tags';
|
import {getTagsList} from '../tags';
|
||||||
|
|
||||||
const tags = {
|
const tags = {
|
||||||
|
@ -32,24 +33,24 @@ const invalidTags = {
|
||||||
|
|
||||||
describe('showcase tags', () => {
|
describe('showcase tags', () => {
|
||||||
it('get tag list', async () => {
|
it('get tag list', async () => {
|
||||||
const tagList = await getTagsList({
|
const {tagKeys} = await getTagsList({
|
||||||
configTags: tags,
|
configTags: fromPartial(tags),
|
||||||
configPath: '',
|
configPath: '',
|
||||||
});
|
});
|
||||||
expect(tagList).toEqual(Object.keys(tags));
|
expect(tagKeys).toEqual(Object.keys(tags));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('get tag list from file', async () => {
|
it('get tag list from file', async () => {
|
||||||
const tagList = await getTagsList({
|
const {tagKeys} = await getTagsList({
|
||||||
configTags: './__fixtures__/tags.yml',
|
configTags: './__fixtures__/tags.yml',
|
||||||
configPath: __dirname,
|
configPath: __dirname,
|
||||||
});
|
});
|
||||||
expect(tagList).toEqual(Object.keys(tags));
|
expect(tagKeys).toEqual(Object.keys(tags));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('error get tag list', async () => {
|
it('error get tag list', async () => {
|
||||||
const tagList = getTagsList({
|
const tagList = getTagsList({
|
||||||
configTags: invalidTags,
|
configTags: fromPartial(invalidTags),
|
||||||
configPath: '',
|
configPath: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ const tags = {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function prepareSchema() {
|
async function prepareSchema() {
|
||||||
const tagList = await getTagsList({
|
const {tagKeys} = await getTagsList({
|
||||||
configTags: tags,
|
configTags: fromPartial(tags),
|
||||||
configPath: '',
|
configPath: '',
|
||||||
});
|
});
|
||||||
return createShowcaseItemSchema(tagList);
|
return createShowcaseItemSchema(tagKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('showcase item schema', () => {
|
describe('showcase item schema', () => {
|
||||||
|
@ -57,6 +57,7 @@ describe('showcase item schema', () => {
|
||||||
description: 'description',
|
description: 'description',
|
||||||
preview: 'preview',
|
preview: 'preview',
|
||||||
source: 'source',
|
source: 'source',
|
||||||
|
// @ts-expect-error: invalid tag
|
||||||
tags: ['invalid'],
|
tags: ['invalid'],
|
||||||
website: 'website',
|
website: 'website',
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue