diff --git a/packages/docusaurus-plugin-content-showcase/src/__tests__/options.test.ts b/packages/docusaurus-plugin-content-showcase/src/__tests__/options.test.ts index 4b95f8dfe3..f35c05ae6d 100644 --- a/packages/docusaurus-plugin-content-showcase/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-content-showcase/src/__tests__/options.test.ts @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +import {fromPartial} from '@total-typescript/shoehorn'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; import {validateOptions, DEFAULT_OPTIONS} from '../options'; import type {Options} from '@docusaurus/plugin-content-showcase'; @@ -101,7 +102,7 @@ describe('normalizeShowcasePluginOptions', () => { }, }, }; - expect(testValidate(userOptions)).toEqual({ + expect(testValidate(fromPartial(userOptions))).toEqual({ ...defaultOptions, ...userOptions, }); diff --git a/packages/docusaurus-plugin-content-showcase/src/__tests__/tags.test.ts b/packages/docusaurus-plugin-content-showcase/src/__tests__/tags.test.ts index 3e756b31e1..ac4946ec56 100644 --- a/packages/docusaurus-plugin-content-showcase/src/__tests__/tags.test.ts +++ b/packages/docusaurus-plugin-content-showcase/src/__tests__/tags.test.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import {fromPartial} from '@total-typescript/shoehorn'; import {getTagsList} from '../tags'; const tags = { @@ -32,24 +33,24 @@ const invalidTags = { describe('showcase tags', () => { it('get tag list', async () => { - const tagList = await getTagsList({ - configTags: tags, + const {tagKeys} = await getTagsList({ + configTags: fromPartial(tags), configPath: '', }); - expect(tagList).toEqual(Object.keys(tags)); + expect(tagKeys).toEqual(Object.keys(tags)); }); it('get tag list from file', async () => { - const tagList = await getTagsList({ + const {tagKeys} = await getTagsList({ configTags: './__fixtures__/tags.yml', configPath: __dirname, }); - expect(tagList).toEqual(Object.keys(tags)); + expect(tagKeys).toEqual(Object.keys(tags)); }); it('error get tag list', async () => { const tagList = getTagsList({ - configTags: invalidTags, + configTags: fromPartial(invalidTags), configPath: '', }); diff --git a/packages/docusaurus-plugin-content-showcase/src/__tests__/validation.test.ts b/packages/docusaurus-plugin-content-showcase/src/__tests__/validation.test.ts index 6d6d501eac..8145d7dbd0 100644 --- a/packages/docusaurus-plugin-content-showcase/src/__tests__/validation.test.ts +++ b/packages/docusaurus-plugin-content-showcase/src/__tests__/validation.test.ts @@ -31,11 +31,11 @@ const tags = { }; async function prepareSchema() { - const tagList = await getTagsList({ - configTags: tags, + const {tagKeys} = await getTagsList({ + configTags: fromPartial(tags), configPath: '', }); - return createShowcaseItemSchema(tagList); + return createShowcaseItemSchema(tagKeys); } describe('showcase item schema', () => { @@ -57,6 +57,7 @@ describe('showcase item schema', () => { description: 'description', preview: 'preview', source: 'source', + // @ts-expect-error: invalid tag tags: ['invalid'], website: 'website', };