File size: 1,372 Bytes
2a93706
21ad36a
2a93706
 
 
 
 
 
 
 
 
 
 
21ad36a
2a93706
 
 
21ad36a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
  });
});