@microtica/mocks
v1.4.9
Published
Mock services for automated tests
Downloads
26
Maintainers
Readme
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
}
})();