UNPKG

@variablesoftware/mock-d1

Version:

🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers

17 lines (16 loc) 830 B
/** * @file helpers/mockInject.ts * @description Provides the mock-only `inject` method for mockD1Database. * @warning This is a mock/test-only API. Do not use in production. Will emit a warning if called outside test. */ import { D1TableData } from '../types/MockD1Database.js'; import type { MockD1TableColumn } from '../types/MockD1Database.js'; /** * Injects rows into a table in the mock D1 database (mock only). * Emits a warning if used outside of test environments. * @param db - The internal Map of tables to rows. * @param tableName - The table name. * @param columns - The explicit table schema columns (required). * @param rows - The rows to inject. */ export declare function mockInject(db: Map<string, D1TableData>, tableName: string, columns: MockD1TableColumn[], rows: Record<string, unknown>[]): void;