mirror of
https://github.com/Sea-Haven-Industries/sh-mcp.git
synced 2026-10-07 10:28:57 +00:00
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
|
|
import { describe, it, expect } from 'vitest';
|
||
|
|
import { InMemorySchedulerClient } from '../src/dev-client.js';
|
||
|
|
|
||
|
|
const baseInput = {
|
||
|
|
scheduleName: 'reminder-abc',
|
||
|
|
scheduleAt: '2026-07-01T16:00:00Z',
|
||
|
|
targetArn: 'arn:aws:lambda:us-east-1:000000000000:function:reminder-deliver',
|
||
|
|
payload: { message: 'Follow up with vendor' },
|
||
|
|
roleArn: 'arn:aws:iam::000000000000:role/scheduler-role',
|
||
|
|
};
|
||
|
|
|
||
|
|
describe('InMemorySchedulerClient', () => {
|
||
|
|
describe('createSchedule', () => {
|
||
|
|
it('returns a deterministic ARN derived from the schedule name', async () => {
|
||
|
|
const client = new InMemorySchedulerClient();
|
||
|
|
const out = await client.createSchedule(baseInput);
|
||
|
|
expect(out.scheduleArn).toBe(
|
||
|
|
'arn:aws:scheduler:us-east-1:000000000000:schedule/dev/reminder-abc',
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('pushes each input to the public created array in call order', async () => {
|
||
|
|
const client = new InMemorySchedulerClient();
|
||
|
|
expect(client.created).toEqual([]);
|
||
|
|
await client.createSchedule(baseInput);
|
||
|
|
await client.createSchedule({ ...baseInput, scheduleName: 'reminder-xyz' });
|
||
|
|
expect(client.created).toHaveLength(2);
|
||
|
|
expect(client.created[0]).toBe(baseInput);
|
||
|
|
expect(client.created[1].scheduleName).toBe('reminder-xyz');
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|