@keboola/api-fixtures
v52.0.0
Published
Typed test fixtures keyed by Keboola API endpoint
Readme
@keboola/api-fixtures
Typed test fixtures keyed by Keboola API endpoint. Use them in stories, unit
tests, and MSW handlers instead of hand-writing response shapes — the fixtures
are typed by @keboola/api-client, so they stay in sync with the SDK.
Installation
npm install --save-dev @keboola/api-fixtures
# or
pnpm add -D @keboola/api-fixtures@keboola/api-client is a peer dependency (the fixtures re-export its endpoint
types). Install it alongside if you haven't already.
Usage
import { fixtures } from '@keboola/api-fixtures';
const table = fixtures.storage.tables.getTable();
const tables = fixtures.storage.tables.listTables();Per-endpoint helpers and types are also exported directly:
import { getTable, listTables, tableFixtures } from '@keboola/api-fixtures';
import type { Table, TableDetail } from '@keboola/api-fixtures';With MSW
import { http, HttpResponse } from 'msw';
import { fixtures } from '@keboola/api-fixtures';
export const handlers = [
http.get('*/v2/storage/tables/:id', () => HttpResponse.json(fixtures.storage.tables.getTable())),
];