ContextKeeper v1.0.0 — Persistent AI coding session context Chrome extension
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { PlatformDetector } from '../src/lib/detector';
|
||||
|
||||
describe('PlatformDetector', () => {
|
||||
const detector = new PlatformDetector();
|
||||
|
||||
it('detects ChatGPT URLs', () => {
|
||||
expect(detector.detect('https://chatgpt.com/c/123')).toBe('chatgpt');
|
||||
expect(detector.detect('https://chat.openai.com/chat')).toBe('chatgpt');
|
||||
});
|
||||
|
||||
it('detects Claude URLs', () => {
|
||||
expect(detector.detect('https://claude.ai/chat/abc')).toBe('claude');
|
||||
});
|
||||
|
||||
it('detects Cursor URLs', () => {
|
||||
expect(detector.detect('https://cursor.sh/chat')).toBe('cursor');
|
||||
});
|
||||
|
||||
it('detects Gemini URLs', () => {
|
||||
expect(detector.detect('https://gemini.google.com/app')).toBe('gemini');
|
||||
expect(detector.detect('https://aistudio.google.com/app')).toBe('gemini');
|
||||
});
|
||||
|
||||
it('detects Copilot URLs', () => {
|
||||
expect(detector.detect('https://copilot.microsoft.com/')).toBe('copilot');
|
||||
expect(detector.detect('https://github.com/copilot')).toBe('copilot');
|
||||
});
|
||||
|
||||
it('returns null for unrelated URLs', () => {
|
||||
expect(detector.detect('https://google.com')).toBeNull();
|
||||
expect(detector.detect('https://example.com')).toBeNull();
|
||||
});
|
||||
|
||||
it('maps platform keys to display names', () => {
|
||||
expect(detector.getPlatformName('chatgpt')).toBe('ChatGPT');
|
||||
expect(detector.getPlatformName('claude')).toBe('Claude');
|
||||
expect(detector.getPlatformName('unknown')).toBe('unknown');
|
||||
});
|
||||
|
||||
it('lists all supported platforms', () => {
|
||||
const platforms = detector.getSupportedPlatforms();
|
||||
expect(platforms).toContain('chatgpt');
|
||||
expect(platforms).toContain('claude');
|
||||
expect(platforms).toContain('cursor');
|
||||
expect(platforms).toContain('gemini');
|
||||
expect(platforms).toContain('copilot');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user