UNPKG

@microtica/mocks

Version:

Mock services for automated tests

51 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const runner_1 = require("../runner"); const CONTAINER_NAME = "microtica_dynamodb_test"; const IMAGE_NAME = "amazon/dynamodb-local"; const PORT = 8000; /** * Spins DynamoDB in Docker for you * * @export * @class DynamoDB */ class DynamoDBDocker { /** * Creates an instance of DynamoDB. * @memberof DynamoDBDocker */ constructor() { this.docker = new runner_1.DockerRunner(IMAGE_NAME, CONTAINER_NAME); } /** * Creates url that can be used to access the local DynamoDB server * * @returns http://localhost:port format URL * @memberof DynamoDBDocker */ getURL() { return `http://localhost:${PORT}`; } /** * Spins a new DynamoDB docker container * * @memberof DynamoDBDocker */ async start() { await this.docker.run({ env: [], portsToOpen: [PORT] }); } /** * Can be used to stop the new container from running * * @memberof DynamoDBDocker */ async stop() { await this.docker.remove(); } } exports.DynamoDBDocker = DynamoDBDocker; //# sourceMappingURL=index.js.map