Files
automaker/apps/server/tests/unit/providers/cursor-provider.test.ts
gsxdsm 9305ecc242 Fix: Restore views properly, model selection for commit and pr and speed up some cli models with session resume (#801)
* Changes from fix/restoring-view

* feat: Add resume query safety checks and optimize store selectors

* feat: Improve session management and model normalization

* refactor: Extract prompt building logic and handle file path parsing for renames
2026-02-22 10:45:45 -08:00

40 lines
1.2 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { CursorProvider } from '@/providers/cursor-provider.js';
describe('cursor-provider.ts', () => {
describe('buildCliArgs', () => {
it('adds --resume when sdkSessionId is provided', () => {
const provider = Object.create(CursorProvider.prototype) as CursorProvider & {
cliPath?: string;
};
provider.cliPath = '/usr/local/bin/cursor-agent';
const args = provider.buildCliArgs({
prompt: 'Continue the task',
model: 'gpt-5',
cwd: '/tmp/project',
sdkSessionId: 'cursor-session-123',
});
const resumeIndex = args.indexOf('--resume');
expect(resumeIndex).toBeGreaterThan(-1);
expect(args[resumeIndex + 1]).toBe('cursor-session-123');
});
it('does not add --resume when sdkSessionId is omitted', () => {
const provider = Object.create(CursorProvider.prototype) as CursorProvider & {
cliPath?: string;
};
provider.cliPath = '/usr/local/bin/cursor-agent';
const args = provider.buildCliArgs({
prompt: 'Start a new task',
model: 'gpt-5',
cwd: '/tmp/project',
});
expect(args).not.toContain('--resume');
});
});
});