@microtica/mocks
TypeScript icon, indicating that this package has built-in type declarations

1.4.9 • Public • Published

Microtica test-friendly mocks

A library which provides various mocking utilities, mainly for AWS APIs and databases.

Some of the features require installed and running Docker engine

Installation

npm i @microtica/mocks -D

Usage

Docker

Exported classes which have docker in their name require docker engine to be running in order to be used

import * as DynamoDB from "aws-sdk/clients/dynamodb";
import { LocalStackDocker } from "@microtica/mocks";

(async () => {
    const server = new LocalStackDocker();
    try {
        await server.start(); // starts new LocalStack container
        const client = new DynamoDB();
        console.log(await client.listTables().promise()); // check whether local AWS APIs are running
    } catch (e) {
        console.error(e);
    } finally {
        server.stop(); // optionally, you can stop the container or leave it for future usages
    }
})();

Mocks

/@microtica/mocks/

    Package Sidebar

    Install

    npm i @microtica/mocks

    Weekly Downloads

    57

    Version

    1.4.9

    License

    MIT

    Unpacked Size

    54 kB

    Total Files

    32

    Last publish

    Collaborators

    • microtica-org