25 lines
866 B
TypeScript
25 lines
866 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
parseFileCheckExcelRunId,
|
|
rewriteFileCheckExcelLinksForDisplay,
|
|
} from './fileCheckExcelDownload';
|
|
|
|
describe('fileCheckExcelDownload', () => {
|
|
it('parses tool api excel link with token', () => {
|
|
expect(parseFileCheckExcelRunId(
|
|
'http://192.168.100.230:8890/api/file-check/tools/runs/187/excel?token=abc',
|
|
)).toBe(187);
|
|
});
|
|
|
|
it('parses workspace excel link', () => {
|
|
expect(parseFileCheckExcelRunId('/api/workspace/file-check/runs/42/excel')).toBe(42);
|
|
});
|
|
|
|
it('rewrites tool api links to workspace paths for display', () => {
|
|
const input = '下载:[链接](http://ai.example.com/api/file-check/tools/runs/9/excel?token=xyz)';
|
|
expect(rewriteFileCheckExcelLinksForDisplay(input)).toBe(
|
|
'下载:[链接](/api/workspace/file-check/runs/9/excel)',
|
|
);
|
|
});
|
|
});
|