Skip to content

Commit b14fc94

Browse files
t3dotggclaude
andcommitted
test(scheduler): race test checks the save keeps a moved next run
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0dd0a0c commit b14fc94

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/server/src/scheduledTasks/ScheduledTaskService.interval.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ it.effect("runs a one-time schedule once and rejects past times", () =>
182182
);
183183

184184
const ONCE = { type: "once", runAt: "2026-11-01T08:00:00Z" } as const;
185+
/** A next run that only the simulated concurrent write produces. */
186+
const MOVED = "2030-01-01T00:00:00.000Z";
185187

186188
const onceInput = {
187189
...input,
@@ -190,13 +192,13 @@ const onceInput = {
190192
};
191193

192194
it.effect.each([
193-
{ change: "a run completes", saved: ONCE, edited: ONCE, pause: false, expected: null },
195+
{ change: "a run completes", saved: ONCE, edited: ONCE, pause: false, expected: MOVED },
194196
{
195197
change: "a run completes during a padded-time edit",
196198
saved: { type: "fixed_time", timeOfDay: "9:00" },
197199
edited: { type: "fixed_time", timeOfDay: "09:00" },
198200
pause: false,
199-
expected: null,
201+
expected: MOVED,
200202
},
201203
{
202204
change: "another client pauses the task",
@@ -218,7 +220,7 @@ it.effect.each([
218220
return Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({
219221
namedProjectsRoot: "/projects",
220222
isScratchProject: () =>
221-
sql`UPDATE scheduled_tasks SET next_run_at = NULL, enabled = ${pause ? 0 : 1}`.pipe(
223+
sql`UPDATE scheduled_tasks SET next_run_at = ${MOVED}, enabled = ${pause ? 0 : 1}`.pipe(
222224
Effect.as(false),
223225
Effect.orDie,
224226
),

0 commit comments

Comments
 (0)