mirror of
https://github.com/Sea-Haven-Industries/sh-mcp.git
synced 2026-09-30 04:13:14 +00:00
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
|
|
import { describe, it, expect } from 'vitest';
|
||
|
|
import { InMemoryInternalDataClient } from '../src/dev-client.js';
|
||
|
|
|
||
|
|
describe('InMemoryInternalDataClient', () => {
|
||
|
|
describe('getWorkOrder', () => {
|
||
|
|
it('returns the seeded record for a known id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
const wo = await client.getWorkOrder('WO-1001');
|
||
|
|
expect(wo?.workOrderId).toBe('WO-1001');
|
||
|
|
expect(wo?.title).toBe('Replace dock lighting circuit');
|
||
|
|
expect(wo?.status).toBe('in_progress');
|
||
|
|
});
|
||
|
|
|
||
|
|
it('returns null for an unknown id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
expect(await client.getWorkOrder('WO-9999')).toBeNull();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('getPurchaseOrder', () => {
|
||
|
|
it('returns the seeded record for a known id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
const po = await client.getPurchaseOrder('PO-2001');
|
||
|
|
expect(po?.purchaseOrderId).toBe('PO-2001');
|
||
|
|
expect(po?.vendor).toBe('Coastal Supply & Hardware');
|
||
|
|
expect(po?.totalAmount).toBe(1842.5);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('returns null for an unknown id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
expect(await client.getPurchaseOrder('PO-9999')).toBeNull();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('getSite', () => {
|
||
|
|
it('returns the seeded record for a known id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
const site = await client.getSite('SITE-01');
|
||
|
|
expect(site?.siteId).toBe('SITE-01');
|
||
|
|
expect(site?.name).toBe('Marina Pier Complex');
|
||
|
|
});
|
||
|
|
|
||
|
|
it('returns null for an unknown id', async () => {
|
||
|
|
const client = new InMemoryInternalDataClient();
|
||
|
|
expect(await client.getSite('SITE-99')).toBeNull();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|