test(team): update change extractor review coverage
This commit is contained in:
parent
bda2af87e4
commit
ae717c7f00
1 changed files with 16 additions and 56 deletions
|
|
@ -520,24 +520,15 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const aliceLogPath = path.join(tmpDir, 'alice.jsonl');
|
const aliceLogPath = path.join(tmpDir, 'alice.jsonl');
|
||||||
await writeJsonl(aliceLogPath, [
|
await writeJsonl(aliceLogPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const findLogFileRefsForTask = vi.fn(
|
const findLogFileRefsForTask = vi.fn(async (_teamName: string, _taskId: string, options?: any) =>
|
||||||
async (_teamName: string, _taskId: string, options?: any) =>
|
options?.owner === 'alice' ? [{ filePath: aliceLogPath, memberName: 'alice' }] : []
|
||||||
options?.owner === 'alice' ? [{ filePath: aliceLogPath, memberName: 'alice' }] : []
|
|
||||||
);
|
);
|
||||||
const service = createService({ logPaths: [aliceLogPath], findLogFileRefsForTask }).service;
|
const service = createService({ logPaths: [aliceLogPath], findLogFileRefsForTask }).service;
|
||||||
|
|
||||||
const empty = await service.getTaskChanges(TEAM_NAME, TASK_ID, {
|
const empty = await service.getTaskChanges(TEAM_NAME, TASK_ID, { owner: 'bob', status: 'completed' });
|
||||||
owner: 'bob',
|
|
||||||
status: 'completed',
|
|
||||||
});
|
|
||||||
const populated = await service.getTaskChanges(TEAM_NAME, TASK_ID, {
|
const populated = await service.getTaskChanges(TEAM_NAME, TASK_ID, {
|
||||||
owner: 'alice',
|
owner: 'alice',
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
|
|
@ -554,12 +545,7 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const logPath = path.join(tmpDir, 'alice-summary.jsonl');
|
const logPath = path.join(tmpDir, 'alice-summary.jsonl');
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { service, findLogFileRefsForTask } = createService({ logPaths: [logPath] });
|
const { service, findLogFileRefsForTask } = createService({ logPaths: [logPath] });
|
||||||
|
|
@ -587,12 +573,7 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const logPath = path.join(tmpDir, 'alice-restart.jsonl');
|
const logPath = path.join(tmpDir, 'alice-restart.jsonl');
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const first = createService({ logPaths: [logPath] });
|
const first = createService({ logPaths: [logPath] });
|
||||||
|
|
@ -615,30 +596,15 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const logPath = path.join(tmpDir, 'alice-refresh.jsonl');
|
const logPath = path.join(tmpDir, 'alice-refresh.jsonl');
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { service } = createService({ logPaths: [logPath] });
|
const { service } = createService({ logPaths: [logPath] });
|
||||||
await service.getTaskChanges(TEAM_NAME, TASK_ID, SUMMARY_OPTIONS);
|
await service.getTaskChanges(TEAM_NAME, TASK_ID, SUMMARY_OPTIONS);
|
||||||
|
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 2;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
buildAssistantWriteEntry('tool-2', '/repo/src/extra.ts', 'export const extra = true;\n', '2026-03-01T10:02:00.000Z'),
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 2;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
buildAssistantWriteEntry(
|
|
||||||
'tool-2',
|
|
||||||
'/repo/src/extra.ts',
|
|
||||||
'export const extra = true;\n',
|
|
||||||
'2026-03-01T10:02:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const refreshed = await service.getTaskChanges(TEAM_NAME, TASK_ID, {
|
const refreshed = await service.getTaskChanges(TEAM_NAME, TASK_ID, {
|
||||||
|
|
@ -662,12 +628,7 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const logPath = path.join(tmpDir, 'alice-review.jsonl');
|
const logPath = path.join(tmpDir, 'alice-review.jsonl');
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { service } = createService({ logPaths: [logPath] });
|
const { service } = createService({ logPaths: [logPath] });
|
||||||
|
|
@ -700,12 +661,7 @@ describe('ChangeExtractorService', () => {
|
||||||
|
|
||||||
const logPath = path.join(tmpDir, 'alice-project-drift.jsonl');
|
const logPath = path.join(tmpDir, 'alice-project-drift.jsonl');
|
||||||
await writeJsonl(logPath, [
|
await writeJsonl(logPath, [
|
||||||
buildAssistantWriteEntry(
|
buildAssistantWriteEntry('tool-1', '/repo/src/file.ts', 'export const value = 1;\n', '2026-03-01T10:00:00.000Z'),
|
||||||
'tool-1',
|
|
||||||
'/repo/src/file.ts',
|
|
||||||
'export const value = 1;\n',
|
|
||||||
'2026-03-01T10:00:00.000Z'
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await createService({ logPaths: [logPath], projectPath: '/repo-a' }).service.getTaskChanges(
|
await createService({ logPaths: [logPath], projectPath: '/repo-a' }).service.getTaskChanges(
|
||||||
|
|
@ -714,7 +670,11 @@ describe('ChangeExtractorService', () => {
|
||||||
SUMMARY_OPTIONS
|
SUMMARY_OPTIONS
|
||||||
);
|
);
|
||||||
const drifted = createService({ logPaths: [logPath], projectPath: '/repo-b' });
|
const drifted = createService({ logPaths: [logPath], projectPath: '/repo-b' });
|
||||||
await drifted.service.getTaskChanges(TEAM_NAME, TASK_ID, SUMMARY_OPTIONS);
|
await drifted.service.getTaskChanges(
|
||||||
|
TEAM_NAME,
|
||||||
|
TASK_ID,
|
||||||
|
SUMMARY_OPTIONS
|
||||||
|
);
|
||||||
|
|
||||||
expect((drifted.findLogFileRefsForTask as any).mock.calls.length).toBeGreaterThan(1);
|
expect((drifted.findLogFileRefsForTask as any).mock.calls.length).toBeGreaterThan(1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue