@kiwiproject/kiwi-test-js 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,30 @@
1
- declare function startElasticSearchContainer(): Promise<void>;
1
+ /**
2
+ * Starts an Elastic search container and stores the container information in global.ELASTIC_SEARCH_CONTAINER.
3
+ *
4
+ * @param image The image name/version to use for elastic search. Defaults to elasticsearch:8.6.1.
5
+ */
6
+ declare function startElasticSearchContainer(image?: string): Promise<void>;
7
+ /**
8
+ * Stops a previously started Elastic search container. Error will be thrown if startElasticSearchContainer was not
9
+ * previously called.
10
+ */
2
11
  declare function stopElasticSearchContainer(): Promise<void>;
12
+ declare function setElasticSearchUrl(host: string, port: number): void;
13
+ /**
14
+ * Retrieves the URL for accessing the running Elastic Search container. Error will be thrown if startElasticSearchContainer
15
+ * was not previously called.
16
+ */
3
17
  declare function getElasticSearchUrl(): string;
18
+ declare function createIndex(indexName: string, indexMapping: unknown, pipelines: Array<unknown>): Promise<void>;
19
+ declare function clearIndex(indexName: string): Promise<void>;
20
+ declare function deleteIndex(indexName: string): Promise<void>;
4
21
  export declare const ElasticSearchExtension: {
5
22
  startElasticSearchContainer: typeof startElasticSearchContainer;
6
23
  stopElasticSearchContainer: typeof stopElasticSearchContainer;
24
+ setElasticSearchUrl: typeof setElasticSearchUrl;
7
25
  getElasticSearchUrl: typeof getElasticSearchUrl;
26
+ createIndex: typeof createIndex;
27
+ clearIndex: typeof clearIndex;
28
+ deleteIndex: typeof deleteIndex;
8
29
  };
9
30
  export {};
@@ -12,26 +12,86 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ElasticSearchExtension = void 0;
13
13
  const kiwi_js_1 = require("@kiwiproject/kiwi-js");
14
14
  const elasticsearch_1 = require("@testcontainers/elasticsearch");
15
- function startElasticSearchContainer() {
15
+ const elasticsearch_2 = require("@elastic/elasticsearch");
16
+ /**
17
+ * Starts an Elastic search container and stores the container information in global.ELASTIC_SEARCH_CONTAINER.
18
+ *
19
+ * @param image The image name/version to use for elastic search. Defaults to elasticsearch:8.6.1.
20
+ */
21
+ function startElasticSearchContainer(image = "elasticsearch:8.6.1") {
16
22
  return __awaiter(this, void 0, void 0, function* () {
17
- global.ELASTIC_SEARCH_CONTAINER = yield new elasticsearch_1.ElasticsearchContainer("elasticsearch:8.6.1")
23
+ const container = yield new elasticsearch_1.ElasticsearchContainer(image)
18
24
  .withEnvironment({ "xpack.security.enabled": "false" })
19
25
  .start();
26
+ process.env.ELASTIC_SEARCH_EXTENSION_BASE_URI = container.getHttpUrl();
27
+ // NOTE: This will only work if tests are runInBand (i.e. not in parallel)
28
+ global.ELASTIC_SEARCH_CONTAINER = container;
20
29
  });
21
30
  }
31
+ /**
32
+ * Stops a previously started Elastic search container. Error will be thrown if startElasticSearchContainer was not
33
+ * previously called.
34
+ */
22
35
  function stopElasticSearchContainer() {
23
36
  return __awaiter(this, void 0, void 0, function* () {
24
- kiwi_js_1.KiwiPreconditions.checkState(global.ELASTIC_SEARCH_CONTAINER !== undefined, "Elastic Search container has not been previously started");
37
+ kiwi_js_1.KiwiPreconditions.checkState(global.ELASTIC_SEARCH_CONTAINER !== undefined, "Elastic Search container has not been previously started or is not running in band");
25
38
  yield global.ELASTIC_SEARCH_CONTAINER.stop();
26
39
  global.ELASTIC_SEARCH_CONTAINER = undefined;
40
+ delete process.env.ELASTIC_SEARCH_EXTENSION_BASE_URI;
27
41
  });
28
42
  }
43
+ function setElasticSearchUrl(host, port) {
44
+ process.env.ELASTIC_SEARCH_EXTENSION_BASE_URI = `http://${host}:${port}`;
45
+ }
46
+ /**
47
+ * Retrieves the URL for accessing the running Elastic Search container. Error will be thrown if startElasticSearchContainer
48
+ * was not previously called.
49
+ */
29
50
  function getElasticSearchUrl() {
30
- kiwi_js_1.KiwiPreconditions.checkState(global.ELASTIC_SEARCH_CONTAINER !== undefined, "Elastic Search container has not been previously started");
31
- return global.ELASTIC_SEARCH_CONTAINER.getHttpUrl();
51
+ kiwi_js_1.KiwiPreconditions.checkState(process.env.ELASTIC_SEARCH_EXTENSION_BASE_URI !== undefined, "Elastic Search container has not been previously started");
52
+ return process.env.ELASTIC_SEARCH_EXTENSION_BASE_URI;
53
+ }
54
+ function createIndex(indexName, indexMapping, pipelines) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const client = new elasticsearch_2.Client({ node: getElasticSearchUrl() });
57
+ yield client.indices.create({
58
+ index: indexName,
59
+ mappings: indexMapping,
60
+ });
61
+ for (const pipeline of pipelines) {
62
+ yield client.ingest.putPipeline(pipeline);
63
+ }
64
+ yield client.close();
65
+ });
66
+ }
67
+ function clearIndex(indexName) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const client = new elasticsearch_2.Client({ node: getElasticSearchUrl() });
70
+ yield client.deleteByQuery({
71
+ index: indexName,
72
+ query: {
73
+ match_all: {},
74
+ },
75
+ refresh: true,
76
+ });
77
+ yield client.close();
78
+ });
79
+ }
80
+ function deleteIndex(indexName) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const client = new elasticsearch_2.Client({ node: getElasticSearchUrl() });
83
+ yield client.indices.delete({
84
+ index: indexName,
85
+ });
86
+ yield client.close();
87
+ });
32
88
  }
33
89
  exports.ElasticSearchExtension = {
34
90
  startElasticSearchContainer,
35
91
  stopElasticSearchContainer,
92
+ setElasticSearchUrl,
36
93
  getElasticSearchUrl,
94
+ createIndex,
95
+ clearIndex,
96
+ deleteIndex,
37
97
  };
@@ -1,9 +1,26 @@
1
- declare function startMinioSearchContainer(accessKey: string, secretKey: string): Promise<void>;
2
- declare function stopMinioSearchContainer(): Promise<void>;
1
+ /**
2
+ * Starts a Minio container and stores the container information in global.MINIO_CONTAINER
3
+ *
4
+ * @param accessKey The access key configured to connect. Defaults to minioadmin.
5
+ * @param secretKey The secret key configured to connect. Defaults to keyboard cat.
6
+ * @param image The image name/version to use for minio. Defaults to minio/minio:RELEASE.2023-08-09T23-30-22Z.
7
+ */
8
+ declare function startMinioContainer(accessKey?: string, secretKey?: string, image?: string): Promise<void>;
9
+ /**
10
+ * Stops a previously started Minio container. Error will be thrown if startMinioContainer has not been
11
+ * previously called.
12
+ */
13
+ declare function stopMinioContainer(): Promise<void>;
14
+ declare function setMinioPort(port: number): void;
15
+ /**
16
+ * Retrieves the mapped external port of the started Minio container. Error will be thrown if startMinioContainer was
17
+ * not previously called.
18
+ */
3
19
  declare function getMinioPort(): number;
4
20
  export declare const MinioExtension: {
5
- startMinioSearchContainer: typeof startMinioSearchContainer;
6
- stopMinioSearchContainer: typeof stopMinioSearchContainer;
21
+ startMinioContainer: typeof startMinioContainer;
22
+ stopMinioContainer: typeof stopMinioContainer;
23
+ setMinioPort: typeof setMinioPort;
7
24
  getMinioPort: typeof getMinioPort;
8
25
  };
9
26
  export {};
@@ -12,36 +12,57 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MinioExtension = void 0;
13
13
  const kiwi_js_1 = require("@kiwiproject/kiwi-js");
14
14
  const testcontainers_1 = require("testcontainers");
15
- function startMinioSearchContainer(accessKey, secretKey) {
15
+ /**
16
+ * Starts a Minio container and stores the container information in global.MINIO_CONTAINER
17
+ *
18
+ * @param accessKey The access key configured to connect. Defaults to minioadmin.
19
+ * @param secretKey The secret key configured to connect. Defaults to keyboard cat.
20
+ * @param image The image name/version to use for minio. Defaults to minio/minio:RELEASE.2023-08-09T23-30-22Z.
21
+ */
22
+ function startMinioContainer(accessKey = "minioadmin", secretKey = "keyboard cat", image = "minio/minio:RELEASE.2023-08-09T23-30-22Z") {
16
23
  return __awaiter(this, void 0, void 0, function* () {
17
- console.log(accessKey);
18
- console.log(secretKey);
19
- global.MINIO_CONTAINER = yield new testcontainers_1.GenericContainer('quay.io/minio/minio:latest')
24
+ const container = yield new testcontainers_1.GenericContainer(image)
20
25
  .withEnvironment({
21
- MINIO_BROWSER: 'off',
26
+ MINIO_BROWSER: "off",
22
27
  MINIO_ROOT_USER: accessKey,
23
28
  MINIO_ROOT_PASSWORD: secretKey,
24
29
  })
25
30
  .withExposedPorts(9000)
26
31
  .withWaitStrategy(testcontainers_1.Wait.forAll([testcontainers_1.Wait.forListeningPorts(), testcontainers_1.Wait.forLogMessage(/1 Online/)]))
27
- .withTmpFs({ '/data': 'rw,noexec,nosuid' })
28
- .withCommand(['server', '/data'])
32
+ .withTmpFs({ "/data": "rw,noexec,nosuid" })
33
+ .withCommand(["server", "/data"])
29
34
  .start();
35
+ setMinioPort(container.getMappedPort(9000));
36
+ // NOTE: This will only work if tests are runInBand (i.e. not in parallel)
37
+ global.MINIO_CONTAINER = container;
30
38
  });
31
39
  }
32
- function stopMinioSearchContainer() {
40
+ /**
41
+ * Stops a previously started Minio container. Error will be thrown if startMinioContainer has not been
42
+ * previously called.
43
+ */
44
+ function stopMinioContainer() {
33
45
  return __awaiter(this, void 0, void 0, function* () {
34
- kiwi_js_1.KiwiPreconditions.checkState(global.MINIO_CONTAINER !== undefined, "Minio container has not been previously started");
46
+ kiwi_js_1.KiwiPreconditions.checkState(global.MINIO_CONTAINER !== undefined, "Minio container has not been previously started or is not running in band");
35
47
  yield global.MINIO_CONTAINER.stop();
36
48
  global.MINIO_CONTAINER = undefined;
49
+ delete process.env.MINIO_EXTENSION_PORT;
37
50
  });
38
51
  }
52
+ function setMinioPort(port) {
53
+ process.env.MINIO_EXTENSION_PORT = String(port);
54
+ }
55
+ /**
56
+ * Retrieves the mapped external port of the started Minio container. Error will be thrown if startMinioContainer was
57
+ * not previously called.
58
+ */
39
59
  function getMinioPort() {
40
- kiwi_js_1.KiwiPreconditions.checkState(global.MINIO_CONTAINER !== undefined, "Minio container has not been previously started");
41
- return global.MINIO_CONTAINER.getMappedPort(9000);
60
+ kiwi_js_1.KiwiPreconditions.checkState(process.env.MINIO_EXTENSION_PORT !== undefined, "Minio container has not been previously started");
61
+ return parseInt(process.env.MINIO_EXTENSION_PORT, 10);
42
62
  }
43
63
  exports.MinioExtension = {
44
- startMinioSearchContainer,
45
- stopMinioSearchContainer,
64
+ startMinioContainer,
65
+ stopMinioContainer,
66
+ setMinioPort,
46
67
  getMinioPort,
47
68
  };
@@ -1,11 +1,33 @@
1
- declare function startMongoContainer(): Promise<void>;
1
+ /**
2
+ * Starts a Mongo container and stores the container information in global.MONGO_CONTAINER.
3
+ *
4
+ * @param image The image name/version to use for mongo. Defaults to mongo:6.
5
+ */
6
+ declare function startMongoContainer(image?: string): Promise<void>;
7
+ /**
8
+ * Stops a previously started Mongo container. Error will be thrown if startMongoContainer is not
9
+ * previously called.
10
+ */
2
11
  declare function stopMongoContainer(): Promise<void>;
12
+ declare function setMongoBaseUrl(host: string, port: number): void;
13
+ /**
14
+ * Retrieves the base connection URL for accessing the running Mongo. Error will be thrown if startMongoContainer
15
+ * is not previously called.
16
+ */
3
17
  declare function getMongoBaseUrl(): string;
18
+ /**
19
+ * Retrieves the base connection URL plus the given db name for accessing the running Mongo. Error will be thrown if
20
+ * startMongoContainer is not previously called.
21
+ * @param dbName The name of the database in mongo to connect.
22
+ */
4
23
  declare function getMongoUriWithDb(dbName: string): string;
24
+ declare function dropDatabase(dbName: string): Promise<void>;
5
25
  export declare const MongoExtension: {
6
26
  startMongoContainer: typeof startMongoContainer;
7
27
  stopMongoContainer: typeof stopMongoContainer;
28
+ setMongoBaseUrl: typeof setMongoBaseUrl;
8
29
  getMongoBaseUrl: typeof getMongoBaseUrl;
9
30
  getMongoUriWithDb: typeof getMongoUriWithDb;
31
+ dropDatabase: typeof dropDatabase;
10
32
  };
11
33
  export {};
@@ -12,32 +12,67 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoExtension = void 0;
13
13
  const kiwi_js_1 = require("@kiwiproject/kiwi-js");
14
14
  const testcontainers_1 = require("testcontainers");
15
- function startMongoContainer() {
15
+ const mongodb_1 = require("mongodb");
16
+ /**
17
+ * Starts a Mongo container and stores the container information in global.MONGO_CONTAINER.
18
+ *
19
+ * @param image The image name/version to use for mongo. Defaults to mongo:6.
20
+ */
21
+ function startMongoContainer(image = "mongo:6") {
16
22
  return __awaiter(this, void 0, void 0, function* () {
17
- global.MONGO_CONTAINER = yield new testcontainers_1.GenericContainer("mongo")
23
+ const container = yield new testcontainers_1.GenericContainer(image)
18
24
  .withExposedPorts(27017)
19
25
  .start();
26
+ setMongoBaseUrl(container.getHost(), container.getMappedPort(27017));
27
+ // NOTE: This will only work if tests are runInBand (i.e. not in parallel)
28
+ global.MONGO_CONTAINER = container;
20
29
  });
21
30
  }
31
+ /**
32
+ * Stops a previously started Mongo container. Error will be thrown if startMongoContainer is not
33
+ * previously called.
34
+ */
22
35
  function stopMongoContainer() {
23
36
  return __awaiter(this, void 0, void 0, function* () {
24
- kiwi_js_1.KiwiPreconditions.checkState(global.MONGO_CONTAINER !== undefined, "Mongo container has not been previously started");
37
+ kiwi_js_1.KiwiPreconditions.checkState(global.MONGO_CONTAINER !== undefined, "Mongo container has not been previously started or is not running in band");
25
38
  yield global.MONGO_CONTAINER.stop();
26
39
  global.MONGO_CONTAINER = undefined;
40
+ delete process.env.MONGO_EXTENSION_BASE_URI;
27
41
  });
28
42
  }
43
+ function setMongoBaseUrl(host, port) {
44
+ process.env.MONGO_EXTENSION_BASE_URI = `mongodb://${host}:${port}/`;
45
+ }
46
+ /**
47
+ * Retrieves the base connection URL for accessing the running Mongo. Error will be thrown if startMongoContainer
48
+ * is not previously called.
49
+ */
29
50
  function getMongoBaseUrl() {
30
- kiwi_js_1.KiwiPreconditions.checkState(global.MONGO_CONTAINER !== undefined, "Mongo container has not been previously started");
31
- const host = global.MONGO_CONTAINER.getHost();
32
- const port = global.MONGO_CONTAINER.getMappedPort(27017);
33
- return `mongodb://${host}:${port}/`;
51
+ kiwi_js_1.KiwiPreconditions.checkState(process.env.MONGO_EXTENSION_BASE_URI !== undefined, "Mongo container has not been previously started");
52
+ return process.env.MONGO_EXTENSION_BASE_URI;
34
53
  }
54
+ /**
55
+ * Retrieves the base connection URL plus the given db name for accessing the running Mongo. Error will be thrown if
56
+ * startMongoContainer is not previously called.
57
+ * @param dbName The name of the database in mongo to connect.
58
+ */
35
59
  function getMongoUriWithDb(dbName) {
36
60
  return `${getMongoBaseUrl()}${dbName}`;
37
61
  }
62
+ function dropDatabase(dbName) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const client = new mongodb_1.MongoClient(getMongoBaseUrl());
65
+ yield client.connect();
66
+ const db = client.db(dbName);
67
+ yield db.dropDatabase();
68
+ yield client.close(true);
69
+ });
70
+ }
38
71
  exports.MongoExtension = {
39
72
  startMongoContainer,
40
73
  stopMongoContainer,
74
+ setMongoBaseUrl,
41
75
  getMongoBaseUrl,
42
76
  getMongoUriWithDb,
77
+ dropDatabase,
43
78
  };
@@ -1,13 +1,42 @@
1
- declare function startPostgresContainer(): Promise<void>;
1
+ /**
2
+ * Starts a Postgres container and stores the container information in global.POSTGRES_CONTAINER.
3
+ *
4
+ * @param image The image name/version to use for postgres. Defaults to postgres:15.
5
+ */
6
+ declare function startPostgresContainer(image?: string): Promise<void>;
7
+ /**
8
+ * Stops a previously started Postgres container. Error will be thrown if startPostgresContainer is not
9
+ * previously called.
10
+ */
2
11
  declare function stopPostgresContainer(): Promise<void>;
12
+ declare function setPostgresBaseUrl(host: string, port: number, user?: string, password?: string, dbName?: string): void;
13
+ /**
14
+ * Retrieves the base URL for accessing the running Postgres container. Error will be thrown if
15
+ * startPostgresContainer is not previously called.
16
+ */
3
17
  declare function getPostgresBaseUrl(): string;
18
+ /**
19
+ * Retrieves the base URL plus a given database for accessing the running Postgres container. Error will be thrown if
20
+ * startPostgresContainer is not previously called.
21
+ *
22
+ * @param dbName The name of the database to add to the connection string.
23
+ */
4
24
  declare function getPostgresUriWithDb(dbName: string): string;
25
+ /**
26
+ * Creates a new database with the given name in the running Postgres. Error will be thrown if
27
+ * startPostgresContainer is not previously called.
28
+ *
29
+ * @param dbName The name of the database to create.
30
+ */
5
31
  declare function setupNewDatabase(dbName: string): Promise<void>;
32
+ declare function dropDatabase(dbName: string): Promise<void>;
6
33
  export declare const PostgresExtension: {
7
34
  startPostgresContainer: typeof startPostgresContainer;
8
35
  stopPostgresContainer: typeof stopPostgresContainer;
36
+ setPostgresBaseUrl: typeof setPostgresBaseUrl;
9
37
  getPostgresBaseUrl: typeof getPostgresBaseUrl;
10
38
  getPostgresUriWithDb: typeof getPostgresUriWithDb;
11
39
  setupNewDatabase: typeof setupNewDatabase;
40
+ dropDatabase: typeof dropDatabase;
12
41
  };
13
42
  export {};
@@ -13,25 +13,57 @@ exports.PostgresExtension = void 0;
13
13
  const kiwi_js_1 = require("@kiwiproject/kiwi-js");
14
14
  const postgresql_1 = require("@testcontainers/postgresql");
15
15
  const pg_1 = require("pg");
16
- function startPostgresContainer() {
16
+ /**
17
+ * Starts a Postgres container and stores the container information in global.POSTGRES_CONTAINER.
18
+ *
19
+ * @param image The image name/version to use for postgres. Defaults to postgres:15.
20
+ */
21
+ function startPostgresContainer(image = "postgres:15") {
17
22
  return __awaiter(this, void 0, void 0, function* () {
18
- global.POSTGRES_CONTAINER = yield new postgresql_1.PostgreSqlContainer().start();
23
+ const container = yield new postgresql_1.PostgreSqlContainer(image).start();
24
+ process.env.POSTGRES_EXTENSION_BASE_URI = container.getConnectionUri();
25
+ // NOTE: This will only work if tests are runInBand (i.e. not in parallel)
26
+ global.POSTGRES_CONTAINER = container;
19
27
  });
20
28
  }
29
+ /**
30
+ * Stops a previously started Postgres container. Error will be thrown if startPostgresContainer is not
31
+ * previously called.
32
+ */
21
33
  function stopPostgresContainer() {
22
34
  return __awaiter(this, void 0, void 0, function* () {
23
- kiwi_js_1.KiwiPreconditions.checkState(global.POSTGRES_CONTAINER !== undefined, "Postgres container has not been previously started");
35
+ kiwi_js_1.KiwiPreconditions.checkState(global.POSTGRES_CONTAINER !== undefined, "Postgres container has not been previously started or is not running in band");
24
36
  yield global.POSTGRES_CONTAINER.stop();
25
37
  global.POSTGRES_CONTAINER = undefined;
38
+ delete process.env.POSTGRES_EXTENSION_BASE_URI;
26
39
  });
27
40
  }
41
+ function setPostgresBaseUrl(host, port, user = "test", password = "test", dbName = "test") {
42
+ process.env.POSTGRES_EXTENSION_BASE_URI = `postgres://${user}:${password}@${host}:${port}/${dbName}`;
43
+ }
44
+ /**
45
+ * Retrieves the base URL for accessing the running Postgres container. Error will be thrown if
46
+ * startPostgresContainer is not previously called.
47
+ */
28
48
  function getPostgresBaseUrl() {
29
- kiwi_js_1.KiwiPreconditions.checkState(global.POSTGRES_CONTAINER !== undefined, "Postgres container has not been previously started");
30
- return global.POSTGRES_CONTAINER.getConnectionUri();
49
+ kiwi_js_1.KiwiPreconditions.checkState(process.env.POSTGRES_EXTENSION_BASE_URI !== undefined, "Postgres container has not been previously started");
50
+ return process.env.POSTGRES_EXTENSION_BASE_URI;
31
51
  }
52
+ /**
53
+ * Retrieves the base URL plus a given database for accessing the running Postgres container. Error will be thrown if
54
+ * startPostgresContainer is not previously called.
55
+ *
56
+ * @param dbName The name of the database to add to the connection string.
57
+ */
32
58
  function getPostgresUriWithDb(dbName) {
33
59
  return getPostgresBaseUrl().replace(/\/test$/, `/${dbName}`);
34
60
  }
61
+ /**
62
+ * Creates a new database with the given name in the running Postgres. Error will be thrown if
63
+ * startPostgresContainer is not previously called.
64
+ *
65
+ * @param dbName The name of the database to create.
66
+ */
35
67
  function setupNewDatabase(dbName) {
36
68
  return __awaiter(this, void 0, void 0, function* () {
37
69
  const dbClient = new pg_1.Client({
@@ -42,10 +74,23 @@ function setupNewDatabase(dbName) {
42
74
  yield dbClient.end();
43
75
  });
44
76
  }
77
+ function dropDatabase(dbName) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const dbClient = new pg_1.Client({
80
+ connectionString: getPostgresBaseUrl(),
81
+ });
82
+ yield dbClient.connect();
83
+ yield dbClient.query(`select pg_terminate_backend(pid) from pg_stat_activity where datname = '${dbName}'`);
84
+ yield dbClient.query(`drop database ${dbName}`);
85
+ yield dbClient.end();
86
+ });
87
+ }
45
88
  exports.PostgresExtension = {
46
89
  startPostgresContainer,
47
90
  stopPostgresContainer,
91
+ setPostgresBaseUrl,
48
92
  getPostgresBaseUrl,
49
93
  getPostgresUriWithDb,
50
94
  setupNewDatabase,
95
+ dropDatabase,
51
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwiproject/kiwi-test-js",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "kiwi-test-js is a test utility library. Most of these utilities are ports from the Java Kiwi-test library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,24 +22,25 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "@jest/globals": "29.6.2",
25
+ "@elastic/elasticsearch": "8.8.1",
26
+ "@jest/globals": "29.6.4",
26
27
  "@kiwiproject/kiwi-js": "0.8.0",
27
28
  "@testcontainers/elasticsearch": "10.2.1",
28
29
  "@testcontainers/postgresql": "10.2.1",
29
- "jest": "29.6.2",
30
- "mongodb": "5.7.0",
31
- "pg": "8.11.2",
30
+ "jest": "29.6.4",
31
+ "mongodb": "5.8.1",
32
+ "pg": "8.11.3",
32
33
  "testcontainers": "10.2.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@babel/core": "7.22.10",
36
37
  "@babel/preset-env": "7.22.10",
37
38
  "@babel/preset-typescript": "7.22.5",
38
- "@types/node": "20.5.0",
39
+ "@types/node": "20.5.4",
39
40
  "@types/pg": "8.10.2",
40
- "@typescript-eslint/eslint-plugin": "6.4.0",
41
- "@typescript-eslint/parser": "6.4.0",
42
- "babel-jest": "29.6.2",
41
+ "@typescript-eslint/eslint-plugin": "6.4.1",
42
+ "@typescript-eslint/parser": "6.4.1",
43
+ "babel-jest": "29.6.3",
43
44
  "eslint": "8.47.0",
44
45
  "prettier": "3.0.2",
45
46
  "typescript": "5.1.6"