mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 06:50:36 +02:00
test(reading-time): Unit tests for calculating reading time (#11116)
This commit is contained in:
parent
16ebd55ef6
commit
fadb6d2607
8 changed files with 233 additions and 8 deletions
|
@ -9,7 +9,6 @@ import fs from 'fs-extra';
|
|||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import readingTime from 'reading-time';
|
||||
import {
|
||||
parseMarkdownFile,
|
||||
normalizeUrl,
|
||||
|
@ -32,6 +31,7 @@ import {getTagsFile} from '@docusaurus/utils-validation';
|
|||
import {validateBlogPostFrontMatter} from './frontMatter';
|
||||
import {getBlogPostAuthors} from './authors';
|
||||
import {reportAuthorsProblems} from './authorsProblems';
|
||||
import {calculateReadingTime} from './readingTime';
|
||||
import type {TagsFile} from '@docusaurus/utils';
|
||||
import type {LoadContext, ParseFrontMatter} from '@docusaurus/types';
|
||||
import type {
|
||||
|
@ -211,7 +211,7 @@ async function parseBlogPostMarkdownFile({
|
|||
}
|
||||
|
||||
const defaultReadingTime: ReadingTimeFunction = ({content, options}) =>
|
||||
readingTime(content, options).minutes;
|
||||
calculateReadingTime(content, options);
|
||||
|
||||
async function processBlogSourceFile(
|
||||
blogSourceRelative: string,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue