test: fix some type errors in test files (#7486)

This commit is contained in:
Joshua Chen 2022-05-25 11:46:10 +08:00 committed by GitHub
parent 624735bd92
commit e2e40b8f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 319 additions and 182 deletions

View file

@ -21,7 +21,7 @@ function process(doc: string, plugins: Plugin[] = []) {
return removePosition(processor.runSync(processor.parse(doc)), true);
}
function heading(label: string, id: string) {
function heading(label: string | null, id: string) {
return u(
'heading',
{depth: 2, data: {id, hProperties: {id}}},

View file

@ -13,15 +13,15 @@ import plugin from '..';
import transformImage, {type PluginOptions} from '../../transformImage';
const processFixture = async (name: string, options?: PluginOptions) => {
const filePath = path.join(__dirname, `__fixtures__/${name}.md`);
const siteDir = path.join(__dirname, `__fixtures__`);
const staticDirs = [
path.join(__dirname, '__fixtures__/static'),
path.join(__dirname, '__fixtures__/static2'),
path.join(siteDir, 'static'),
path.join(siteDir, 'static2'),
];
const file = await vfile.read(filePath);
const file = await vfile.read(path.join(siteDir, `${name}.md`));
const result = await remark()
.use(mdx)
.use(transformImage, {...options, filePath, staticDirs})
.use(transformImage, {...options, siteDir, staticDirs})
.use(plugin, {
...options,
staticDirs,