Files
wehub-resource-sync 3a28426bf4
Lint and Format Check / lint-and-format (push) Failing after 0s
Check Migrations / Check for duplicate migration numbers (push) Failing after 1s
CI Pre-merge Check / CI Pre-merge Check (push) Failing after 2m17s
chore: import upstream snapshot with attribution
2026-07-13 12:23:40 +08:00

35 lines
1.3 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import * as fs from 'fs';
import * as path from 'path';
import { LEGACY_DOCS_MAP, SDK_DOCS_MAP } from '@/api/routes/docs/index.routes.js';
describe('Documentation Maps', () => {
const projectRoot = process.env.PROJECT_ROOT || path.resolve(__dirname, '../../..');
const docsRoot = path.join(projectRoot, 'docs');
it('resolves all legacy docs map paths to existing files', () => {
for (const [key, docFileName] of Object.entries(LEGACY_DOCS_MAP)) {
const filePath = path.join(docsRoot, docFileName);
const exists = fs.existsSync(filePath);
expect(exists, `Expected file for legacy doc type '${key}' to exist at: ${filePath}`).toBe(
true
);
}
});
it('resolves all sdk docs map paths to existing files', () => {
for (const [feature, languages] of Object.entries(SDK_DOCS_MAP)) {
for (const [language, docFileName] of Object.entries(languages)) {
if (docFileName) {
const filePath = path.join(docsRoot, docFileName);
const exists = fs.existsSync(filePath);
expect(
exists,
`Expected file for SDK doc feature '${feature}' language '${language}' to exist at: ${filePath}`
).toBe(true);
}
}
}
});
});