Unit Tests / test (pull_request) Successful in 10s
Hide Documents without features.rag, polish upload/active toggle, add personal and company-manager Drive connect sections, and show upgrade messaging when chat RAG is denied by plan. Companion to chat_backend#42 Closes #81 #82 #83 #84 #85
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { driveConnectUrl, parseResourceIdsInput } from './drive';
|
|
|
|
describe('parseResourceIdsInput', () => {
|
|
it('splits comma and newline separated ids and trims whitespace', () => {
|
|
expect(parseResourceIdsInput('abc, def\nghi ,, ')).toEqual(['abc', 'def', 'ghi']);
|
|
});
|
|
|
|
it('returns an empty array for blank input', () => {
|
|
expect(parseResourceIdsInput(' ')).toEqual([]);
|
|
});
|
|
});
|
|
|
|
describe('driveConnectUrl', () => {
|
|
const originalEnv = process.env.REACT_APP_BACKEND_REST_API_BASE_URL;
|
|
|
|
beforeAll(() => {
|
|
process.env.REACT_APP_BACKEND_REST_API_BASE_URL = 'https://api.example.com/';
|
|
});
|
|
|
|
afterAll(() => {
|
|
process.env.REACT_APP_BACKEND_REST_API_BASE_URL = originalEnv;
|
|
});
|
|
|
|
it('builds a personal drive-link url', () => {
|
|
expect(driveConnectUrl('google', 'link_drive')).toBe(
|
|
'https://api.example.com/auth/oauth/google/start/?intent=link_drive'
|
|
);
|
|
});
|
|
|
|
it('builds a company drive-link url', () => {
|
|
expect(driveConnectUrl('microsoft', 'link_company_drive')).toBe(
|
|
'https://api.example.com/auth/oauth/microsoft/start/?intent=link_company_drive'
|
|
);
|
|
});
|
|
});
|