azure-mock
v2.31.1
Published
A library that contains azure mock classes.
Downloads
923
Maintainers
Readme
azure-mock
Mock Azure service classes for local development and testing. Provides in-memory implementations of Azure Table Storage, Blob Storage, Queue Storage, and EventGrid clients that mirror the real Azure SDK interfaces.
Table of Contents
🚀 Getting Started
pnpm i -D azure-mock @azure/core-http-compat @azure/core-rest-pipeline @azure/data-tables @azure/eventgrid @azure/storage-blob @azure/storage-queue📖 Documentation
We highly recommend you take a look at the documentation to level up.
Available Mocks
| Class | Azure Equivalent | Description |
| ------------------------------ | -------------------------- | ----------------------------- |
| MockTableClient | TableClient | In-memory Azure Table Storage |
| MockBlobServiceClient | BlobServiceClient | In-memory Azure Blob Storage |
| MockQueueClient | QueueClient | In-memory Azure Queue Storage |
| MockEventGridPublisherClient | EventGridPublisherClient | No-op EventGrid publisher |
Usage
import { MockTableClient } from "azure-mock";
const mockTableClient = new MockTableClient("", "tableName");
await mockTableClient.upsertEntity({ partitionKey: "pk", rowKey: "rk", value: 42 });
const entity = await mockTableClient.getEntity("pk", "rk");Replace real Azure clients with their mock equivalents by swapping them in your test setup or local .env configuration.
Commands
Run from packages/azure-mock/:
pnpm build # compile to dist/
pnpm test # vitest watch mode (coverage is run from the repo root)
pnpm lint:fix # auto-fix lint
pnpm typecheck # type check⚖️ License
This project is licensed under the Apache-2.0 license.
