feat!: client storage is read-only, storage.save and storage.delete removed

This commit is contained in:
edmand46
2026-09-29 16:43:15 +03:00
parent b115450715
commit 17a55888a5
11 changed files with 28 additions and 104 deletions
-15
View File
@@ -15,7 +15,6 @@ export interface RecordedRequest {
export interface FakeGatewayState {
storage: Map<string, StorageItem>;
currencies: CatalogCurrency[];
/** Response per `module/fn`; falls back to `{ result: {} }`. */
moduleCalls: Map<string, CallModuleFunctionClientResponse>;
}
@@ -32,7 +31,6 @@ function json(body: unknown, status = 200): Response {
});
}
const noContent = (): Response => new Response(null, { status: 204 });
export function createFakeGateway(seed?: Partial<FakeGatewayState>): FakeGateway {
const state: FakeGatewayState = {
@@ -79,19 +77,6 @@ export function createFakeGateway(seed?: Partial<FakeGatewayState>): FakeGateway
);
return json({ items, nextCursor: '' });
}
if (method === 'PUT') {
const items = (body as { items?: StorageItem[] }).items ?? [];
for (const item of items) {
if (item.type) state.storage.set(item.type, { id: `id-${item.type}`, ...item });
}
return noContent();
}
if (method === 'DELETE') {
const type = query.get('type');
if (type) state.storage.delete(type);
else state.storage.clear();
return noContent();
}
}
return json({ error: `unhandled route: ${method} ${path}` }, 500);