28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { parseAppRoute, pathForApiDocSection } from './routing';
|
|
|
|
describe('API documentation routes', () => {
|
|
it.each([
|
|
['guideBaseUrl', '/docs/auth'],
|
|
['guideWebhook', '/docs/webhook'],
|
|
['guideErrors', '/docs/errors'],
|
|
['guideTesting', '/docs/testing'],
|
|
['responses', '/docs/responses'],
|
|
['videoGeneration', '/docs/videos/generations'],
|
|
['asyncMode', '/docs/async'],
|
|
['taskRetrieve', '/docs/tasks/retrieve'],
|
|
] as const)('maps %s to a stable documentation URL', (section, path) => {
|
|
expect(pathForApiDocSection(section)).toBe(path);
|
|
expect(parseAppRoute(path).apiDocSection).toBe(section);
|
|
});
|
|
|
|
it.each([
|
|
['/docs/playground', 'guideTesting'],
|
|
['/docs/api/responses', 'responses'],
|
|
['/docs/api/videos', 'videoGeneration'],
|
|
['/docs/api/tasks', 'taskRetrieve'],
|
|
] as const)('keeps the legacy documentation URL %s working', (path, section) => {
|
|
expect(parseAppRoute(path).apiDocSection).toBe(section);
|
|
});
|
|
});
|