Bonsai-Chat-WebGPU / src /bench /route.test.ts
Valeriy Selitskiy
Release v1.2.2 interactive chat workspace
21ad36a
Raw
History Blame Contribute Delete
1.37 kB
import { describe, expect, it } from 'vitest';
import { isBenchRoute, isPromptMatrixRoute } from './route';
describe('isBenchRoute', () => {
it('uses the root app query deep-link required by static Spaces', () => {
expect(isBenchRoute({ pathname: '/', search: '?view=bench', hash: '' })).toBe(true);
});
it('keeps path and hash routes usable on hosts that support them', () => {
expect(isBenchRoute({ pathname: '/bench', search: '', hash: '' })).toBe(true);
expect(isBenchRoute({ pathname: '/', search: '', hash: '#/bench' })).toBe(true);
});
it('leaves the chat on the default root route', () => {
expect(isBenchRoute({ pathname: '/', search: '', hash: '' })).toBe(false);
});
});
describe('isPromptMatrixRoute', () => {
it('accepts the explicit diagnostic route forms', () => {
expect(isPromptMatrixRoute({ pathname: '/', search: '?view=prompt-matrix', hash: '' })).toBe(true);
expect(isPromptMatrixRoute({ pathname: '/prompt-matrix', search: '', hash: '' })).toBe(true);
expect(isPromptMatrixRoute({ pathname: '/', search: '', hash: '#/prompt-matrix' })).toBe(true);
});
it('does not capture the chat or benchmark routes', () => {
expect(isPromptMatrixRoute({ pathname: '/', search: '', hash: '' })).toBe(false);
expect(isPromptMatrixRoute({ pathname: '/bench', search: '', hash: '' })).toBe(false);
});
});