Skip to content

Commit

Permalink
test: fix ALL type errors in tests (#7487)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored May 25, 2022
1 parent e2e40b8 commit d50fe3b
Show file tree
Hide file tree
Showing 37 changed files with 407 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {posixPath, getFileCommitDate} from '@docusaurus/utils';
import pluginContentBlog from '../index';
import {validateOptions} from '../options';
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
import type {
DocusaurusConfig,
LoadContext,
I18n,
Validate,
} from '@docusaurus/types';
import type {
BlogPost,
Options,
PluginOptions,
EditUrlFunction,
} from '@docusaurus/plugin-content-blog';
Expand Down Expand Up @@ -77,7 +83,10 @@ const getPlugin = async (
i18n,
} as LoadContext,
validateOptions({
validate: normalizePluginOptions,
validate: normalizePluginOptions as Validate<
Options | undefined,
PluginOptions
>,
options: {
path: PluginPath,
editUrl: BaseEditUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@

import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {validateOptions, DEFAULT_OPTIONS} from '../options';
import type {Options} from '@docusaurus/plugin-content-blog';
import type {Options, PluginOptions} from '@docusaurus/plugin-content-blog';
import type {Validate} from '@docusaurus/types';

function testValidate(options?: Options) {
return validateOptions({validate: normalizePluginOptions, options});
return validateOptions({
validate: normalizePluginOptions as Validate<
Options | undefined,
PluginOptions
>,
options,
});
}

// The type of remark/rehype plugins can be either function, object or array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
{
"loadedVersions": [
{
"badge": true,
"banner": null,
"className": "",
"contentPath": "any",
"contentPathLocalized": "any",
"docs": [
{
"description": "doc1 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc1 title",
Expand All @@ -101,12 +105,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc1 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc2 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc2 title",
Expand All @@ -119,12 +126,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc2 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc3 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc3 title",
Expand All @@ -137,12 +147,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc3 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc4 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc4 title",
Expand All @@ -155,12 +168,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc4 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc5 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc5 title",
Expand All @@ -173,21 +189,24 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc5 title",
"unversionedId": "any",
"version": "any",
},
],
"drafts": [],
"isLast": true,
"label": "current label (translated)",
"mainDocId": "",
"path": "/docs/",
"routePriority": undefined,
"sidebarFilePath": "any",
"sidebars": {
"docs": [
{
"collapsed": false,
"collapsible": true,
"items": [
{
"id": "doc1",
Expand Down Expand Up @@ -233,14 +252,19 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
],
},
"tagsPath": "/tags/",
"versionName": "current",
},
{
"badge": true,
"banner": null,
"className": "",
"contentPath": "any",
"contentPathLocalized": "any",
"docs": [
{
"description": "doc1 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc1 title",
Expand All @@ -253,12 +277,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc1 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc2 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc2 title",
Expand All @@ -271,12 +298,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc2 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc3 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc3 title",
Expand All @@ -289,12 +319,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc3 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc4 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc4 title",
Expand All @@ -307,12 +340,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc4 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc5 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc5 title",
Expand All @@ -325,21 +361,24 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc5 title",
"unversionedId": "any",
"version": "any",
},
],
"drafts": [],
"isLast": true,
"label": "2.0.0 label (translated)",
"mainDocId": "",
"path": "/docs/",
"routePriority": undefined,
"sidebarFilePath": "any",
"sidebars": {
"docs": [
{
"collapsed": false,
"collapsible": true,
"items": [
{
"id": "doc1",
Expand Down Expand Up @@ -385,14 +424,19 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
],
},
"tagsPath": "/tags/",
"versionName": "2.0.0",
},
{
"badge": true,
"banner": null,
"className": "",
"contentPath": "any",
"contentPathLocalized": "any",
"docs": [
{
"description": "doc1 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc1 title",
Expand All @@ -405,12 +449,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc1 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc2 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc2 title",
Expand All @@ -423,12 +470,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc2 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc3 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc3 title",
Expand All @@ -441,12 +491,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc3 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc4 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc4 title",
Expand All @@ -459,12 +512,15 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc4 title",
"unversionedId": "any",
"version": "any",
},
{
"description": "doc5 description",
"draft": false,
"editUrl": "any",
"frontMatter": {
"sidebar_label": "doc5 title",
Expand All @@ -477,21 +533,24 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"previous": undefined,
"slug": "any",
"source": "any",
"sourceDirName": "",
"tags": [],
"title": "doc5 title",
"unversionedId": "any",
"version": "any",
},
],
"drafts": [],
"isLast": true,
"label": "1.0.0 label (translated)",
"mainDocId": "",
"path": "/docs/",
"routePriority": undefined,
"sidebarFilePath": "any",
"sidebars": {
"docs": [
{
"collapsed": false,
"collapsible": true,
"items": [
{
"id": "doc1",
Expand Down Expand Up @@ -537,6 +596,7 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
},
],
},
"tagsPath": "/tags/",
"versionName": "1.0.0",
},
],
Expand Down
Loading

0 comments on commit d50fe3b

Please sign in to comment.