Mock
An in-memory calendar for trying calsdk, testing your app offline and checking a provider against a reference.
The mock needs no credentials and makes no requests, so it's the quickest way to try calsdk and the right thing to put in your tests. It supports everything calsdk models except a free/busy endpoint, which also makes it the reference implementation for provider authors.
npm install @cal-sdk/core @cal-sdk/mockimport { listEvents } from '@cal-sdk/core';
import { mockCalendar } from '@cal-sdk/mock';
const calendar = mockCalendar({
events: [
{
title: 'Standup',
start: { dateTime: '2026-11-02T10:00:00+05:30', timeZone: 'Asia/Kolkata' },
end: { dateTime: '2026-11-02T10:15:00+05:30', timeZone: 'Asia/Kolkata' },
recurrence: ['RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR'],
},
],
});
const { events } = await listEvents({
calendar,
timeMin: '2026-11-01T00:00:00Z',
timeMax: '2026-12-01T00:00:00Z',
});
console.log(calendar.events); // the stored stateHow it behaves
Ids are predictable, evt_1, evt_2 and so on, so your test assertions can name them. An occurrence is <series id>_<UTC start>, like Google's.
Recurrence follows RFC 5545: one RRULE line plus EXDATE lines. RDATE and EXRULE throw UnsupportedFunctionalityError.
Seed events passed in events skip the checks createEvent runs, so give every dateTime an offset. createConference: true adds a placeholder link with provider: 'other'. Free/busy is computed from events by calsdk, with a compatibility warning, as it is for any provider without an endpoint.
Test your code covers the settings and how to use the mock in tests.