mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-10-02 05:59:03 +00:00
27 lines
983 B
TypeScript
27 lines
983 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { buildCodeNavigationUrl, readCodeNavigationHint } from './code-navigation';
|
|
|
|
describe('code navigation helper', () => {
|
|
it('reads code navigation hint from search params', () => {
|
|
const params = new URLSearchParams('codeRepo=https://github.com/apache/hertzbeat&codeProvider=github&codePath=web-next&codeSearch=trace');
|
|
expect(readCodeNavigationHint(params)).toEqual({
|
|
repositoryUrl: 'https://github.com/apache/hertzbeat',
|
|
provider: 'github',
|
|
defaultPath: 'web-next',
|
|
searchQuery: 'trace',
|
|
label: undefined
|
|
});
|
|
});
|
|
|
|
it('builds provider-aware code navigation urls', () => {
|
|
expect(
|
|
buildCodeNavigationUrl({
|
|
repositoryUrl: 'https://github.com/apache/hertzbeat',
|
|
provider: 'github',
|
|
defaultPath: 'web-next',
|
|
searchQuery: 'trace'
|
|
})
|
|
).toBe('https://github.com/apache/hertzbeat/search?q=path%3Aweb-next%20trace&type=code');
|
|
});
|
|
});
|