mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { cleanMarkdownEnv, type CleanMarkdownEnv } from '../src/node/utils/cleanMarkdownEnv.js'
|
|
|
|
describe('cleanMarkdownEnv', () => {
|
|
const env: CleanMarkdownEnv = {
|
|
base: 'base',
|
|
filePath: 'filePath',
|
|
filePathRelative: 'filePathRelative',
|
|
references: 'references',
|
|
abbreviations: 'abbreviations',
|
|
annotations: 'annotations',
|
|
// @ts-expect-error should be ignored
|
|
foo: 'foo',
|
|
bar: 'bar',
|
|
}
|
|
it('should clean markdown env', () => {
|
|
const result = cleanMarkdownEnv(env)
|
|
expect(result).toEqual({
|
|
base: 'base',
|
|
filePath: 'filePath',
|
|
filePathRelative: 'filePathRelative',
|
|
references: 'references',
|
|
abbreviations: 'abbreviations',
|
|
annotations: 'annotations',
|
|
})
|
|
})
|
|
|
|
it('should clean markdown env with excludes', () => {
|
|
const result = cleanMarkdownEnv(env, ['references', 'abbreviations'])
|
|
expect(result).toEqual({
|
|
base: 'base',
|
|
filePath: 'filePath',
|
|
filePathRelative: 'filePathRelative',
|
|
annotations: 'annotations',
|
|
})
|
|
})
|
|
})
|