@microtica/mocks
Version:
Mock services for automated tests
36 lines (27 loc) • 940 B
Markdown
A library which provides various mocking utilities, mainly for AWS APIs and databases.
Some of the features require installed and running Docker engine
```console
npm i @microtica/mocks -D
```
Exported classes which have docker in their name require docker engine to be running in order to be used
```js
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
}
})();
```