medusa-test-utils 1.1.45 → 2.0.0-rc-20241003153304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/dist/database.d.ts +2 -0
  2. package/dist/database.d.ts.map +1 -0
  3. package/dist/database.js +100 -146
  4. package/dist/database.js.map +1 -1
  5. package/dist/events.d.ts +3 -0
  6. package/dist/events.d.ts.map +1 -0
  7. package/dist/events.js +41 -0
  8. package/dist/events.js.map +1 -0
  9. package/dist/id-map.d.ts +3 -2
  10. package/dist/id-map.d.ts.map +1 -0
  11. package/dist/id-map.js +8 -11
  12. package/dist/id-map.js.map +1 -1
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +5 -7
  16. package/dist/index.js.map +1 -1
  17. package/dist/init-modules.d.ts +2 -1
  18. package/dist/init-modules.d.ts.map +1 -0
  19. package/dist/init-modules.js +39 -97
  20. package/dist/init-modules.js.map +1 -1
  21. package/dist/jest.d.ts +1 -0
  22. package/dist/jest.d.ts.map +1 -0
  23. package/dist/jest.js +15 -64
  24. package/dist/jest.js.map +1 -1
  25. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts +10 -5
  26. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts.map +1 -0
  27. package/dist/medusa-test-runner-utils/bootstrap-app.js +53 -147
  28. package/dist/medusa-test-runner-utils/bootstrap-app.js.map +1 -1
  29. package/dist/medusa-test-runner-utils/clear-instances.d.ts +8 -0
  30. package/dist/medusa-test-runner-utils/clear-instances.d.ts.map +1 -0
  31. package/dist/medusa-test-runner-utils/clear-instances.js +14 -0
  32. package/dist/medusa-test-runner-utils/clear-instances.js.map +1 -0
  33. package/dist/medusa-test-runner-utils/config.d.ts +5 -0
  34. package/dist/medusa-test-runner-utils/config.d.ts.map +1 -0
  35. package/dist/medusa-test-runner-utils/config.js +28 -0
  36. package/dist/medusa-test-runner-utils/config.js.map +1 -0
  37. package/dist/medusa-test-runner-utils/index.d.ts +6 -0
  38. package/dist/medusa-test-runner-utils/index.d.ts.map +1 -0
  39. package/dist/medusa-test-runner-utils/index.js +22 -0
  40. package/dist/medusa-test-runner-utils/index.js.map +1 -0
  41. package/dist/medusa-test-runner-utils/use-db.d.ts +15 -12
  42. package/dist/medusa-test-runner-utils/use-db.d.ts.map +1 -0
  43. package/dist/medusa-test-runner-utils/use-db.js +51 -143
  44. package/dist/medusa-test-runner-utils/use-db.js.map +1 -1
  45. package/dist/medusa-test-runner-utils/utils.d.ts +2 -0
  46. package/dist/medusa-test-runner-utils/utils.d.ts.map +1 -0
  47. package/dist/medusa-test-runner-utils/utils.js +10 -0
  48. package/dist/medusa-test-runner-utils/utils.js.map +1 -0
  49. package/dist/medusa-test-runner.d.ts +16 -6
  50. package/dist/medusa-test-runner.d.ts.map +1 -0
  51. package/dist/medusa-test-runner.js +123 -343
  52. package/dist/medusa-test-runner.js.map +1 -1
  53. package/dist/mock-event-bus-service.d.ts +5 -4
  54. package/dist/mock-event-bus-service.d.ts.map +1 -0
  55. package/dist/mock-event-bus-service.js +13 -51
  56. package/dist/mock-event-bus-service.js.map +1 -1
  57. package/dist/module-test-runner.d.ts +4 -2
  58. package/dist/module-test-runner.d.ts.map +1 -0
  59. package/dist/module-test-runner.js +117 -132
  60. package/dist/module-test-runner.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -0
  62. package/package.json +28 -39
  63. package/dist/mock-manager.d.ts +0 -9
  64. package/dist/mock-manager.js +0 -30
  65. package/dist/mock-manager.js.map +0 -1
  66. package/dist/mock-repository.d.ts +0 -51
  67. package/dist/mock-repository.js +0 -193
  68. package/dist/mock-repository.js.map +0 -1
@@ -25,3 +25,5 @@ export declare function getMikroOrmWrapper({ mikroOrmEntities, pathToMigrations,
25
25
  clientUrl?: string;
26
26
  schema?: string;
27
27
  }): TestDatabase;
28
+ export declare const dbTestUtilFactory: () => any;
29
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["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 -1,185 +1,139 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getMikroOrmWrapper = exports.getMikroOrmConfig = exports.getDatabaseURL = void 0;
40
- var postgresql_1 = require("@mikro-orm/postgresql");
3
+ exports.dbTestUtilFactory = void 0;
4
+ exports.getDatabaseURL = getDatabaseURL;
5
+ exports.getMikroOrmConfig = getMikroOrmConfig;
6
+ exports.getMikroOrmWrapper = getMikroOrmWrapper;
7
+ const postgresql_1 = require("@mikro-orm/postgresql");
8
+ const pg_god_1 = require("pg-god");
9
+ const DB_HOST = process.env.DB_HOST ?? "localhost";
10
+ const DB_USERNAME = process.env.DB_USERNAME ?? "";
11
+ const DB_PASSWORD = process.env.DB_PASSWORD ?? "";
12
+ const pgGodCredentials = {
13
+ user: DB_USERNAME,
14
+ password: DB_PASSWORD,
15
+ host: DB_HOST,
16
+ };
41
17
  function getDatabaseURL(dbName) {
42
- var _a, _b;
43
- var DB_HOST = (_a = process.env.DB_HOST) !== null && _a !== void 0 ? _a : "localhost";
44
- var DB_USERNAME = (_b = process.env.DB_USERNAME) !== null && _b !== void 0 ? _b : "";
45
- var DB_PASSWORD = process.env.DB_PASSWORD;
46
- var DB_NAME = dbName !== null && dbName !== void 0 ? dbName : process.env.DB_TEMP_NAME;
47
- return "postgres://".concat(DB_USERNAME).concat(DB_PASSWORD ? ":".concat(DB_PASSWORD) : "", "@").concat(DB_HOST, "/").concat(DB_NAME);
18
+ const DB_HOST = process.env.DB_HOST ?? "localhost";
19
+ const DB_USERNAME = process.env.DB_USERNAME ?? "";
20
+ const DB_PASSWORD = process.env.DB_PASSWORD;
21
+ const DB_NAME = dbName ?? process.env.DB_TEMP_NAME;
22
+ return `postgres://${DB_USERNAME}${DB_PASSWORD ? `:${DB_PASSWORD}` : ""}@${DB_HOST}/${DB_NAME}`;
48
23
  }
49
- exports.getDatabaseURL = getDatabaseURL;
50
- function getMikroOrmConfig(_a) {
51
- var mikroOrmEntities = _a.mikroOrmEntities, pathToMigrations = _a.pathToMigrations, clientUrl = _a.clientUrl, schema = _a.schema;
52
- var DB_URL = clientUrl !== null && clientUrl !== void 0 ? clientUrl : getDatabaseURL();
24
+ function getMikroOrmConfig({ mikroOrmEntities, pathToMigrations, clientUrl, schema, }) {
25
+ const DB_URL = clientUrl ?? getDatabaseURL();
53
26
  return {
54
27
  type: "postgresql",
55
28
  clientUrl: DB_URL,
56
29
  entities: Object.values(mikroOrmEntities),
57
- schema: schema !== null && schema !== void 0 ? schema : process.env.MEDUSA_DB_SCHEMA,
30
+ schema: schema ?? process.env.MEDUSA_DB_SCHEMA,
58
31
  debug: false,
32
+ pool: {
33
+ min: 2,
34
+ },
59
35
  migrations: {
60
36
  pathTs: pathToMigrations,
61
37
  silent: true,
62
38
  },
63
39
  };
64
40
  }
65
- exports.getMikroOrmConfig = getMikroOrmConfig;
66
- function getMikroOrmWrapper(_a) {
67
- var mikroOrmEntities = _a.mikroOrmEntities, pathToMigrations = _a.pathToMigrations, clientUrl = _a.clientUrl, schema = _a.schema;
41
+ function getMikroOrmWrapper({ mikroOrmEntities, pathToMigrations, clientUrl, schema, }) {
68
42
  return {
69
- mikroOrmEntities: mikroOrmEntities,
70
- pathToMigrations: pathToMigrations,
71
- clientUrl: clientUrl !== null && clientUrl !== void 0 ? clientUrl : getDatabaseURL(),
72
- schema: schema !== null && schema !== void 0 ? schema : process.env.MEDUSA_DB_SCHEMA,
43
+ mikroOrmEntities,
44
+ pathToMigrations,
45
+ clientUrl: clientUrl ?? getDatabaseURL(),
46
+ schema: schema ?? process.env.MEDUSA_DB_SCHEMA,
73
47
  orm: null,
74
48
  manager: null,
75
- getManager: function () {
49
+ getManager() {
76
50
  if (this.manager === null) {
77
51
  throw new Error("manager entity not available");
78
52
  }
79
53
  return this.manager;
80
54
  },
81
- forkManager: function () {
55
+ forkManager() {
82
56
  if (this.manager === null) {
83
57
  throw new Error("manager entity not available");
84
58
  }
85
59
  return this.manager.fork();
86
60
  },
87
- getOrm: function () {
61
+ getOrm() {
88
62
  if (this.orm === null) {
89
63
  throw new Error("orm entity not available");
90
64
  }
91
65
  return this.orm;
92
66
  },
93
- setupDatabase: function () {
94
- var _a, _b;
95
- return __awaiter(this, void 0, void 0, function () {
96
- var OrmConfig, _c, err_1, pendingMigrations;
97
- return __generator(this, function (_d) {
98
- switch (_d.label) {
99
- case 0:
100
- OrmConfig = getMikroOrmConfig({
101
- mikroOrmEntities: this.mikroOrmEntities,
102
- pathToMigrations: this.pathToMigrations,
103
- clientUrl: this.clientUrl,
104
- schema: this.schema,
105
- });
106
- // Initializing the ORM
107
- _c = this;
108
- return [4 /*yield*/, postgresql_1.MikroORM.init(OrmConfig)];
109
- case 1:
110
- // Initializing the ORM
111
- _c.orm = _d.sent();
112
- this.manager = this.orm.em;
113
- _d.label = 2;
114
- case 2:
115
- _d.trys.push([2, 4, , 5]);
116
- return [4 /*yield*/, this.orm.getSchemaGenerator().ensureDatabase()];
117
- case 3:
118
- _d.sent();
119
- return [3 /*break*/, 5];
120
- case 4:
121
- err_1 = _d.sent();
122
- console.log(err_1);
123
- return [3 /*break*/, 5];
124
- case 5: return [4 /*yield*/, ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.execute("CREATE SCHEMA IF NOT EXISTS \"".concat((_b = this.schema) !== null && _b !== void 0 ? _b : "public", "\";")))];
125
- case 6:
126
- _d.sent();
127
- return [4 /*yield*/, this.orm
128
- .getMigrator()
129
- .getPendingMigrations()];
130
- case 7:
131
- pendingMigrations = _d.sent();
132
- if (!(pendingMigrations && pendingMigrations.length > 0)) return [3 /*break*/, 9];
133
- return [4 /*yield*/, this.orm
134
- .getMigrator()
135
- .up({ migrations: pendingMigrations.map(function (m) { return m.name; }) })];
136
- case 8:
137
- _d.sent();
138
- return [3 /*break*/, 11];
139
- case 9: return [4 /*yield*/, this.orm.schema.refreshDatabase()]; // ensure db exists and is fresh
140
- case 10:
141
- _d.sent(); // ensure db exists and is fresh
142
- _d.label = 11;
143
- case 11: return [2 /*return*/];
144
- }
145
- });
67
+ async setupDatabase() {
68
+ const OrmConfig = getMikroOrmConfig({
69
+ mikroOrmEntities: this.mikroOrmEntities,
70
+ pathToMigrations: this.pathToMigrations,
71
+ clientUrl: this.clientUrl,
72
+ schema: this.schema,
146
73
  });
74
+ // Initializing the ORM
75
+ this.orm = await postgresql_1.MikroORM.init(OrmConfig);
76
+ this.manager = this.orm.em;
77
+ try {
78
+ await this.orm.getSchemaGenerator().ensureDatabase();
79
+ }
80
+ catch (err) {
81
+ console.log(err);
82
+ }
83
+ await this.manager?.execute(`CREATE SCHEMA IF NOT EXISTS "${this.schema ?? "public"}";`);
84
+ const pendingMigrations = await this.orm
85
+ .getMigrator()
86
+ .getPendingMigrations();
87
+ if (pendingMigrations && pendingMigrations.length > 0) {
88
+ await this.orm
89
+ .getMigrator()
90
+ .up({ migrations: pendingMigrations.map((m) => m.name) });
91
+ }
92
+ else {
93
+ await this.orm.schema.refreshDatabase(); // ensure db exists and is fresh
94
+ }
147
95
  },
148
- clearDatabase: function () {
149
- var _a, _b, _c, _d;
150
- return __awaiter(this, void 0, void 0, function () {
151
- var _e;
152
- return __generator(this, function (_f) {
153
- switch (_f.label) {
154
- case 0:
155
- if (this.orm === null) {
156
- throw new Error("ORM not configured");
157
- }
158
- return [4 /*yield*/, ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.execute("DROP SCHEMA IF EXISTS \"".concat((_b = this.schema) !== null && _b !== void 0 ? _b : "public", "\" CASCADE;")))];
159
- case 1:
160
- _f.sent();
161
- return [4 /*yield*/, ((_c = this.manager) === null || _c === void 0 ? void 0 : _c.execute("CREATE SCHEMA IF NOT EXISTS \"".concat((_d = this.schema) !== null && _d !== void 0 ? _d : "public", "\";")))];
162
- case 2:
163
- _f.sent();
164
- _f.label = 3;
165
- case 3:
166
- _f.trys.push([3, 5, , 6]);
167
- return [4 /*yield*/, this.orm.close()];
168
- case 4:
169
- _f.sent();
170
- return [3 /*break*/, 6];
171
- case 5:
172
- _e = _f.sent();
173
- return [3 /*break*/, 6];
174
- case 6:
175
- this.orm = null;
176
- this.manager = null;
177
- return [2 /*return*/];
178
- }
179
- });
180
- });
96
+ async clearDatabase() {
97
+ if (this.orm === null) {
98
+ throw new Error("ORM not configured");
99
+ }
100
+ await this.manager?.execute(`DROP SCHEMA IF EXISTS "${this.schema ?? "public"}" CASCADE;`);
101
+ await this.manager?.execute(`CREATE SCHEMA IF NOT EXISTS "${this.schema ?? "public"}";`);
102
+ try {
103
+ await this.orm.close();
104
+ }
105
+ catch { }
106
+ this.orm = null;
107
+ this.manager = null;
181
108
  },
182
109
  };
183
110
  }
184
- exports.getMikroOrmWrapper = getMikroOrmWrapper;
111
+ const dbTestUtilFactory = () => ({
112
+ pgConnection_: null,
113
+ create: async function (dbName) {
114
+ await (0, pg_god_1.createDatabase)({ databaseName: dbName, errorIfExist: false }, pgGodCredentials);
115
+ },
116
+ teardown: async function ({ schema } = {}) {
117
+ if (!this.pgConnection_) {
118
+ return;
119
+ }
120
+ const runRawQuery = this.pgConnection_.raw.bind(this.pgConnection_);
121
+ schema ??= "public";
122
+ await runRawQuery(`SET session_replication_role = 'replica';`);
123
+ const { rows: tableNames } = await runRawQuery(`SELECT table_name
124
+ FROM information_schema.tables
125
+ WHERE table_schema = '${schema}';`);
126
+ for (const { table_name } of tableNames) {
127
+ await runRawQuery(`DELETE
128
+ FROM ${schema}."${table_name}";`);
129
+ }
130
+ await runRawQuery(`SET session_replication_role = 'origin';`);
131
+ },
132
+ shutdown: async function (dbName) {
133
+ await this.pgConnection_?.context?.destroy();
134
+ await this.pgConnection_?.destroy();
135
+ return await (0, pg_god_1.dropDatabase)({ databaseName: dbName, errorIfNonExist: false }, pgGodCredentials);
136
+ },
137
+ });
138
+ exports.dbTestUtilFactory = dbTestUtilFactory;
185
139
  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AAE,GAAG,MAAM,WAAW,CAAC;;oEAEiB,MAAM,IAAI,CAAC,CAAA;QAE3E,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,UAAU,EAAE,CAAC;YACxC,MAAM,WAAW,CAAC;kCACU,MAAM,KAAK,UAAU,IAAI,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,WAAW,CAAC,0CAA0C,CAAC,CAAA;IAC/D,CAAC;IAED,QAAQ,EAAE,KAAK,WAAW,MAAc;QACtC,MAAM,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;QAC5C,MAAM,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAA;QAEnC,OAAO,MAAM,IAAA,qBAAY,EACvB,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,EAChD,gBAAgB,CACjB,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAzCW,QAAA,iBAAiB,qBAyC5B"}
@@ -0,0 +1,3 @@
1
+ import { IEventBusModuleService } from "@medusajs/framework/types";
2
+ export declare const waitSubscribersExecution: (eventName: string, eventBus: IEventBusModuleService) => Promise<any[]>;
3
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,eAAO,MAAM,wBAAwB,cACxB,MAAM,YACP,sBAAsB,mBAwCjC,CAAA"}
package/dist/events.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitSubscribersExecution = void 0;
4
+ // Allows you to wait for all subscribers to execute for a given event. Only works with the local event bus.
5
+ const waitSubscribersExecution = (eventName, eventBus) => {
6
+ const eventEmitter = eventBus.eventEmitter_;
7
+ const subscriberPromises = [];
8
+ const originalListeners = eventEmitter.listeners(eventName);
9
+ // If there are no existing listeners, resolve once the event happens. Otherwise, wrap the existing subscribers in a promise and resolve once they are done.
10
+ if (!eventEmitter.listeners(eventName).length) {
11
+ let ok;
12
+ const promise = new Promise((resolve) => {
13
+ ok = resolve;
14
+ });
15
+ subscriberPromises.push(promise);
16
+ eventEmitter.on(eventName, ok);
17
+ }
18
+ else {
19
+ eventEmitter.listeners(eventName).forEach((listener) => {
20
+ eventEmitter.removeListener(eventName, listener);
21
+ let ok, nok;
22
+ const promise = new Promise((resolve, reject) => {
23
+ ok = resolve;
24
+ nok = reject;
25
+ });
26
+ subscriberPromises.push(promise);
27
+ const newListener = async (...args2) => {
28
+ return await listener.apply(eventBus, args2).then(ok).catch(nok);
29
+ };
30
+ eventEmitter.on(eventName, newListener);
31
+ });
32
+ }
33
+ return Promise.all(subscriberPromises).finally(() => {
34
+ eventEmitter.removeAllListeners(eventName);
35
+ originalListeners.forEach((listener) => {
36
+ eventEmitter.on(eventName, listener);
37
+ });
38
+ });
39
+ };
40
+ exports.waitSubscribersExecution = waitSubscribersExecution;
41
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAGA,4GAA4G;AACrG,MAAM,wBAAwB,GAAG,CACtC,SAAiB,EACjB,QAAgC,EAChC,EAAE;IACF,MAAM,YAAY,GAAkB,QAAgB,CAAC,aAAa,CAAA;IAClE,MAAM,kBAAkB,GAAmB,EAAE,CAAA;IAC7C,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAE3D,4JAA4J;IAC5J,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;QAC9C,IAAI,EAAE,CAAA;QACN,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACtC,EAAE,GAAG,OAAO,CAAA;QACd,CAAC,CAAC,CAAA;QAEF,kB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ance;
2
- declare const instance: IdMap;
3
1
  declare class IdMap {
4
2
  ids: {};
5
3
  getId(key: any, prefix?: string, length?: number): any;
6
4
  }
5
+ declare const instance: IdMap;
6
+ export default instance;
7
+ //# sourceMappingURL=id-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-map.d.ts","sourceRoot":"","sources":["../src/id-map.ts"],"names":[],"mappings":"AAEA,cAAM,KAAK;IACT,GAAG,KAAK;IAER,KAAK,CAAC,GAAG,KAAA,EAAE,MAAM,SAAK,EAAE,MAAM,SAAK;CAUpC;AAED,QAAA,MAAM,QAAQ,OAAc,CAAA;AAC5B,eAAe,QAAQ,CAAA"}
package/dist/id-map.js CHANGED
@@ -3,23 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var randomatic_1 = __importDefault(require("randomatic"));
7
- var IdMap = /** @class */ (function () {
8
- function IdMap() {
6
+ const randomatic_1 = __importDefault(require("randomatic"));
7
+ class IdMap {
8
+ constructor() {
9
9
  this.ids = {};
10
10
  }
11
- IdMap.prototype.getId = function (key, prefix, length) {
12
- if (prefix === void 0) { prefix = ""; }
13
- if (length === void 0) { length = 10; }
11
+ getId(key, prefix = "", length = 10) {
14
12
  if (this.ids[key]) {
15
13
  return this.ids[key];
16
14
  }
17
- var id = "".concat(prefix && prefix + "_").concat((0, randomatic_1.default)("Aa0", length));
15
+ const id = `${prefix && prefix + "_"}${(0, randomatic_1.default)("Aa0", length)}`;
18
16
  this.ids[key] = id;
19
17
  return id;
20
- };
21
- return IdMap;
22
- }());
23
- var instance = new IdMap();
18
+ }
19
+ }
20
+ const instance = new IdMap();
24
21
  exports.default = instance;
25
22
  //# sourceMappingURL=id-map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-map.js","sourceRoot":"","sources":["../src/id-map.js"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AA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QAAQ,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export * as TestDatabaseUtils from "./database";
2
+ export * as TestEventUtils from "./events";
2
3
  export { default as IdMap } from "./id-map";
3
- export * as JestUtils from "./jest";
4
- export { default as MockManager } from "./mock-manager";
5
- export { default as MockRepository } from "./mock-repository";
6
4
  export * from "./init-modules";
5
+ export * as JestUtils from "./jest";
6
+ export * from "./medusa-test-runner";
7
+ export * from "./medusa-test-runner-utils";
7
8
  export { default as MockEventBusService } from "./mock-event-bus-service";
8
9
  export * from "./module-test-runner";
9
- export * from "./medusa-test-runner";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,cAAc,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,UAAU,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACzE,cAAc,sBAAsB,CAAA"}
package/dist/index.js CHANGED
@@ -29,18 +29,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.MockEventBusService = exports.MockRepository = exports.MockManager = exports.JestUtils = exports.IdMap = exports.TestDatabaseUtils = void 0;
32
+ exports.MockEventBusService = exports.JestUtils = exports.IdMap = exports.TestEventUtils = exports.TestDatabaseUtils = void 0;
33
33
  exports.TestDatabaseUtils = __importStar(require("./database"));
34
+ exports.TestEventUtils = __importStar(require("./events"));
34
35
  var id_map_1 = require("./id-map");
35
36
  Object.defineProperty(exports, "IdMap", { enumerable: true, get: function () { return __importDefault(id_map_1).default; } });
36
- exports.JestUtils = __importStar(require("./jest"));
37
- var mock_manager_1 = require("./mock-manager");
38
- Object.defineProperty(exports, "MockManager", { enumerable: true, get: function () { return __importDefault(mock_manager_1).default; } });
39
- var mock_repository_1 = require("./mock-repository");
40
- Object.defineProperty(exports, "MockRepository", { enumerable: true, get: function () { return __importDefault(mock_repository_1).default; } });
41
37
  __exportStar(require("./init-modules"), exports);
38
+ exports.JestUtils = __importStar(require("./jest"));
39
+ __exportStar(require("./medusa-test-runner"), exports);
40
+ __exportStar(require("./medusa-test-runner-utils"), exports);
42
41
  var mock_event_bus_service_1 = require("./mock-event-bus-service");
43
42
  Object.defineProperty(exports, "MockEventBusService", { enumerable: true, get: function () { return __importDefault(mock_event_bus_service_1).default; } });
44
43
  __exportStar(require("./module-test-runner"), exports);
45
- __exportStar(require("./medusa-test-runner"), exports);
46
44
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA+C;AAC/C,mCAA2C;AAAlC,gHAAA,OAAO,OAAS;AACzB,oDAAmC;AACnC,+CAAuD;AAA9C,4HAAA,OAAO,OAAe;AAC/B,qDAA6D;AAApD,kIAAA,OAAO,OAAkB;AAClC,iDAA8B;AAC9B,mEAAyE;AAAhE,8IAAA,OAAO,OAAuB;AACvC,uDAAoC;AACpC,uDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA+C;AAC/C,2DAA0C;AAC1C,mCAA2C;AAAlC,gHAAA,OAAO,OAAS;AACzB,iDAA8B;AAC9B,oDAAmC;AACnC,uDAAoC;AACpC,6DAA0C;AAC1C,mEAAyE;AAAhE,8IAAA,OAAO,OAAuB;AACvC,uDAAoC"}
@@ -1,4 +1,4 @@
1
- import { ExternalModuleDeclaration, InternalModuleDeclaration, ModuleJoinerConfig } from "@medusajs/types";
1
+ import { ExternalModuleDeclaration, InternalModuleDeclaration, ModuleJoinerConfig } from "@medusajs/framework/types";
2
2
  export interface InitModulesOptions {
3
3
  injectedDependencies?: Record<string, unknown>;
4
4
  databaseConfig: {
@@ -15,3 +15,4 @@ export declare function initModules({ injectedDependencies, databaseConfig, modu
15
15
  medusaApp: any;
16
16
  shutdown: () => Promise<void>;
17
17
  }>;
18
+ //# sourceMappingURL=init-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-modules.d.ts","sourceRoot":"","sources":["../src/init-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAOlC,MAAM,WAAW,kBAAkB;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9C,cAAc,EAAE;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,aAAa,EAAE;QACb,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,OAAO,GACP,OAAO,CAAC,yBAAyB,GAAG,yBAAyB,CAAC,CAAA;KACnE,CAAA;IACD,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACnC,+BAA+B,CAAC,EAAE,OAAO,CAAA;CAC1C;AAED,wBAAsB,WAAW,CAAC,EAChC,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,+BAAuC,GACxC,EAAE,kBAAkB;;;GAkDpB"}