task-loop-rrule-projection.test.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
10 days ago
| 1 | /** |
| 2 | * Tier 1 — UNIT: RRULE next occurrence + occurrence_key projection. |
| 3 | */ |
| 4 | import { describe, it } from 'node:test'; |
| 5 | import assert from 'node:assert/strict'; |
| 6 | import { projectNextOccurrence } from '../lib/task/task-loop-rrule.mjs'; |
| 7 | |
| 8 | const RECURRENCE = { |
| 9 | kind: 'rrule', |
| 10 | rrule: 'FREQ=WEEKLY;BYDAY=MO', |
| 11 | dtstart: '2026-06-02T16:00:00Z', |
| 12 | anchor_tz: 'America/Los_Angeles', |
| 13 | }; |
| 14 | |
| 15 | describe('Task loop RRULE — occurrence projection', () => { |
| 16 | it('projects next Monday occurrence after June 24 2026', () => { |
| 17 | const projection = projectNextOccurrence( |
| 18 | RECURRENCE, |
| 19 | { until_at: null }, |
| 20 | '2026-06-24T12:00:00Z', |
| 21 | ); |
| 22 | assert.ok(projection); |
| 23 | if (!projection) return; |
| 24 | assert.match(projection.occurrenceKey, /^2026-W\d{2}$/); |
| 25 | assert.ok(projection.occurrenceAt > '2026-06-24T12:00:00Z'); |
| 26 | }); |
| 27 | |
| 28 | it('returns null when series until_at is before after instant', () => { |
| 29 | const projection = projectNextOccurrence( |
| 30 | RECURRENCE, |
| 31 | { until_at: '2026-06-01T00:00:00Z' }, |
| 32 | '2026-06-24T12:00:00Z', |
| 33 | ); |
| 34 | assert.equal(projection, null); |
| 35 | }); |
| 36 | }); |
File History
1 commit
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠
10 days ago