Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion test/cli/watch-capabilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Prioritized by risk: execute > cleanup > decision-hygiene > self-pull > board.
*/

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { WatchContext } from '../../packages/squad-cli/src/cli/commands/watch/types.js';

// ── Shared mock state (hoisted alongside vi.mock) ───────────────────
Expand Down Expand Up @@ -695,6 +695,15 @@ describe('Watch Capabilities', () => {
// ────────────────────────────────────────────────────────────────

describe('RetroCapability', () => {
beforeEach(() => {
vi.useFakeTimers();
vi.setSystemTime(new Date('2026-08-27T12:00:00Z'));
});

afterEach(() => {
vi.useRealTimers();
});

describe('execute', () => {
it('reports not due when a recent retrospective log exists', async () => {
const today = new Date().toISOString().slice(0, 10);
Expand Down Expand Up @@ -723,6 +732,18 @@ describe('Watch Capabilities', () => {
expect(seenDirs.map(d => d.replace(/\\/g, '/'))).toContain('/external/state/log');
expect(result.summary).toBe('retro not due');
});

it('runs a retrospective on Friday afternoon even when one exists today', async () => {
vi.setSystemTime(new Date('2026-08-28T15:00:00Z'));
mockStorage.listSync.mockReturnValue(['2026-08-28-retrospective.md']);

const cap = new RetroCapability();
const result = await cap.execute(makeContext());

expect(result.success).toBe(true);
expect(result.summary).toBe('retrospective completed');
expect(mockExecFile).toHaveBeenCalledOnce();
});
});
});

Expand Down