Esposter
    Preparing search index...

    Module azure-mock - v2.36.0

    azure-mock

    Apache-2.0 licensed NPM version NPM downloads NPM Unpacked Size (with version)

    Mock Azure service classes for local development and testing. Provides in-memory implementations of Azure Table Storage, Blob Storage, Service Bus, and EventGrid clients that mirror the real Azure SDK interfaces.


    pnpm i -D azure-mock @azure/core-http-compat @azure/core-rest-pipeline @azure/data-tables @azure/eventgrid @azure/service-bus @azure/storage-blob
    

    We highly recommend you take a look at the documentation to level up.

    Class Azure Equivalent Description
    MockTableClient TableClient In-memory Azure Table Storage
    MockBlobServiceClient BlobServiceClient In-memory Azure Blob Storage
    MockServiceBusSender ServiceBusSender In-memory Azure Service Bus
    MockEventGridPublisherClient EventGridPublisherClient No-op EventGrid publisher
    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.

    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

    This project is licensed under the Apache-2.0 license.

    MockBlobBatchClient
    MockBlobClient
    MockBlockBlobClient
    MockContainerClient
    MockEventGridPublisherClient
    MockQueueClient
    MockRestError
    MockSearchClient
    MockServiceBusSender
    MockTableClient
    MockWebPubSubServiceClient
    MockResponse
    PagedAsyncIterableIterator
    PageSettings
    BlobHierarchyItem
    MOCK_BLOB_BASE_URL
    MOCK_BLOB_SEEDED_CREATED_ON
    MOCK_QUEUE_BASE_URL
    MOCK_SEARCH_BASE_URL
    MOCK_TABLE_BASE_URL
    MockContainerCreatedOnDatabase
    MockContainerDatabase
    MockEventGridDatabase
    MockQueueDatabase
    MockSearchDatabase
    MockServiceBusDatabase
    MockTableDatabase
    applyFilter
    bodyToBuffer
    compare
    compareByCompositeKey
    createFilterPredicate
    createMockResponse
    getAzureErrorXml
    getBlobItemXml
    getBlobPrefixXml
    getBlobUrl
    getBlobUrlParts
    getListBlobsXml
    getMockContainerCreatedOnKey
    getMockSasUrl
    isNullClause
    isReadableStream
    toWebResourceLike