Files
freecodecamp--freecodecamp/tools/challenge-parser/parser/index.acceptance.test.js
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

67 lines
1.9 KiB
JavaScript

import { resolve } from 'path';
import { describe, it, expect } from 'vitest';
import { parseMD } from '.';
describe('challenge parser', () => {
it('should parse a simple md file', async () => {
const parsed = await parseMD(resolve(__dirname, '__fixtures__/simple.md'));
expect(parsed).toMatchSnapshot();
});
it('should parse a more realistic md file', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/realistic.md')
);
expect(parsed).toMatchSnapshot();
});
it('should import md from other files', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-imports.md')
);
expect(parsed).toMatchSnapshot();
});
it('should parse frontmatter', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-frontmatter.md')
);
expect(parsed).toMatchSnapshot();
});
it('should parse gfm strikethrough and frontmatter', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-gfm.md')
);
expect(parsed).toMatchSnapshot();
});
it('should not mix other YAML with the frontmatter', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-yaml.md')
);
expect(parsed).toMatchSnapshot();
});
it('should parse video questions', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-video-question.md')
);
expect(parsed).toMatchSnapshot();
});
it('should not parse directives we do not use', async () => {
const parsed = await parseMD(
resolve(__dirname, '__fixtures__/with-directives.md')
);
expect(parsed).toMatchSnapshot();
});
it('should parse md with a scene', async () => {
const parsed = await parseMD(resolve(__dirname, '__fixtures__/scene.md'));
expect(parsed).toMatchSnapshot();
});
});