Files
chat_web_app/llm-fe/src/llm-fe/utils/drive.test.ts
T
westfarn 04c4b3b37a
Unit Tests / test (pull_request) Successful in 10s
Gate Documents UI by RAG plan and add Drive connect UX (#81-#85)
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
2026-08-01 15:33:56 -05:00

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'
);
});
});