medusa-test-utils 1.1.45-snapshot-20240717160031 → 1.1.45-snapshot-20240718083016

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/dist/database.d.ts +0 -1
  2. package/dist/database.js +142 -56
  3. package/dist/database.js.map +1 -1
  4. package/dist/id-map.d.ts +2 -3
  5. package/dist/id-map.js +13 -8
  6. package/dist/id-map.js.map +1 -1
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +6 -3
  9. package/dist/index.js.map +1 -1
  10. package/dist/init-modules.d.ts +0 -1
  11. package/dist/init-modules.js +95 -38
  12. package/dist/init-modules.js.map +1 -1
  13. package/dist/jest.d.ts +0 -1
  14. package/dist/jest.js +62 -14
  15. package/dist/jest.js.map +1 -1
  16. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts +5 -10
  17. package/dist/medusa-test-runner-utils/bootstrap-app.js +146 -54
  18. package/dist/medusa-test-runner-utils/bootstrap-app.js.map +1 -1
  19. package/dist/medusa-test-runner-utils/use-db.d.ts +12 -5
  20. package/dist/medusa-test-runner-utils/use-db.js +143 -29
  21. package/dist/medusa-test-runner-utils/use-db.js.map +1 -1
  22. package/dist/medusa-test-runner.d.ts +3 -9
  23. package/dist/medusa-test-runner.js +332 -144
  24. package/dist/medusa-test-runner.js.map +1 -1
  25. package/dist/mock-event-bus-service.d.ts +4 -5
  26. package/dist/mock-event-bus-service.js +51 -13
  27. package/dist/mock-event-bus-service.js.map +1 -1
  28. package/dist/mock-manager.d.ts +9 -0
  29. package/dist/mock-manager.js +30 -0
  30. package/dist/mock-manager.js.map +1 -0
  31. package/dist/mock-repository.d.ts +51 -0
  32. package/dist/mock-repository.js +193 -0
  33. package/dist/mock-repository.js.map +1 -0
  34. package/dist/module-test-runner.d.ts +2 -3
  35. package/dist/module-test-runner.js +129 -60
  36. package/dist/module-test-runner.js.map +1 -1
  37. package/package.json +12 -7
  38. package/dist/database.d.ts.map +0 -1
  39. package/dist/events.d.ts +0 -3
  40. package/dist/events.d.ts.map +0 -1
  41. package/dist/events.js +0 -24
  42. package/dist/events.js.map +0 -1
  43. package/dist/id-map.d.ts.map +0 -1
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/init-modules.d.ts.map +0 -1
  46. package/dist/jest.d.ts.map +0 -1
  47. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts.map +0 -1
  48. package/dist/medusa-test-runner-utils/use-db.d.ts.map +0 -1
  49. package/dist/medusa-test-runner.d.ts.map +0 -1
  50. package/dist/mock-event-bus-service.d.ts.map +0 -1
  51. package/dist/module-test-runner.d.ts.map +0 -1
@@ -1,174 +1,362 @@
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
+ var __values = (this && this.__values) || function(o) {
39
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40
+ if (m) return m.call(o);
41
+ if (o && typeof o.length === "number") return {
42
+ next: function () {
43
+ if (o && i >= o.length) o = void 0;
44
+ return { value: o && o[i++], done: !o };
45
+ }
46
+ };
47
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
+ };
2
49
  Object.defineProperty(exports, "__esModule", { value: true });
3
50
  exports.medusaIntegrationTestRunner = void 0;
4
- const utils_1 = require("@medusajs/utils");
5
- const pg_god_1 = require("pg-god");
6
- const database_1 = require("./database");
7
- const bootstrap_app_1 = require("./medusa-test-runner-utils/bootstrap-app");
8
- const use_db_1 = require("./medusa-test-runner-utils/use-db");
9
- const axios = require("axios").default;
10
- const DB_HOST = process.env.DB_HOST;
11
- const DB_USERNAME = process.env.DB_USERNAME;
12
- const DB_PASSWORD = process.env.DB_PASSWORD;
13
- const pgGodCredentials = {
51
+ var database_1 = require("./database");
52
+ var use_db_1 = require("./medusa-test-runner-utils/use-db");
53
+ var bootstrap_app_1 = require("./medusa-test-runner-utils/bootstrap-app");
54
+ var pg_god_1 = require("pg-god");
55
+ var utils_1 = require("@medusajs/utils");
56
+ var axios = require("axios").default;
57
+ var DB_HOST = process.env.DB_HOST;
58
+ var DB_USERNAME = process.env.DB_USERNAME;
59
+ var DB_PASSWORD = process.env.DB_PASSWORD;
60
+ var pgGodCredentials = {
14
61
  user: DB_USERNAME,
15
62
  password: DB_PASSWORD,
16
63
  host: DB_HOST,
17
64
  };
18
- const dbTestUtilFactory = () => ({
65
+ var dbTestUtilFactory = function () { return ({
66
+ db_: null,
19
67
  pgConnection_: null,
20
- create: async function (dbName) {
21
- await (0, pg_god_1.createDatabase)({ databaseName: dbName }, pgGodCredentials);
68
+ clear: function () {
69
+ var _a;
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ return __generator(this, function (_b) {
72
+ (_a = this.db_) === null || _a === void 0 ? void 0 : _a.synchronize(true);
73
+ return [2 /*return*/];
74
+ });
75
+ });
22
76
  },
23
- teardown: async function ({ schema } = {}) {
24
- if (!this.pgConnection_) {
25
- return;
26
- }
27
- const runRawQuery = this.pgConnection_.raw.bind(this.pgConnection_);
28
- schema ??= "public";
29
- await runRawQuery(`SET session_replication_role = 'replica';`);
30
- const { rows: tableNames } = await runRawQuery(`SELECT table_name
31
- FROM information_schema.tables
32
- WHERE table_schema = '${schema}';`);
33
- for (const { table_name } of tableNames) {
34
- await runRawQuery(`DELETE
35
- FROM ${schema}."${table_name}";`);
36
- }
37
- await runRawQuery(`SET session_replication_role = 'origin';`);
77
+ create: function (dbName) {
78
+ return __awaiter(this, void 0, void 0, function () {
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0: return [4 /*yield*/, (0, pg_god_1.createDatabase)({ databaseName: dbName }, pgGodCredentials)];
82
+ case 1:
83
+ _a.sent();
84
+ return [2 /*return*/];
85
+ }
86
+ });
87
+ });
88
+ },
89
+ teardown: function (_a) {
90
+ var _b = _a === void 0 ? {} : _a, forceDelete = _b.forceDelete, schema = _b.schema;
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ var manager, tableNames, tableNames_1, tableNames_1_1, table_name, e_1_1;
93
+ var e_1, _c;
94
+ return __generator(this, function (_d) {
95
+ switch (_d.label) {
96
+ case 0:
97
+ forceDelete !== null && forceDelete !== void 0 ? forceDelete : (forceDelete = []);
98
+ if (!this.db_) {
99
+ return [2 /*return*/];
100
+ }
101
+ manager = this.db_.manager;
102
+ schema !== null && schema !== void 0 ? schema : (schema = "public");
103
+ return [4 /*yield*/, manager.query("SET session_replication_role = 'replica';")];
104
+ case 1:
105
+ _d.sent();
106
+ return [4 /*yield*/, manager.query("SELECT table_name\n FROM information_schema.tables\n WHERE table_schema = '".concat(schema, "';"))];
107
+ case 2:
108
+ tableNames = _d.sent();
109
+ _d.label = 3;
110
+ case 3:
111
+ _d.trys.push([3, 8, 9, 10]);
112
+ tableNames_1 = __values(tableNames), tableNames_1_1 = tableNames_1.next();
113
+ _d.label = 4;
114
+ case 4:
115
+ if (!!tableNames_1_1.done) return [3 /*break*/, 7];
116
+ table_name = tableNames_1_1.value.table_name;
117
+ return [4 /*yield*/, manager.query("DELETE\n FROM ".concat(schema, ".\"").concat(table_name, "\";"))];
118
+ case 5:
119
+ _d.sent();
120
+ _d.label = 6;
121
+ case 6:
122
+ tableNames_1_1 = tableNames_1.next();
123
+ return [3 /*break*/, 4];
124
+ case 7: return [3 /*break*/, 10];
125
+ case 8:
126
+ e_1_1 = _d.sent();
127
+ e_1 = { error: e_1_1 };
128
+ return [3 /*break*/, 10];
129
+ case 9:
130
+ try {
131
+ if (tableNames_1_1 && !tableNames_1_1.done && (_c = tableNames_1.return)) _c.call(tableNames_1);
132
+ }
133
+ finally { if (e_1) throw e_1.error; }
134
+ return [7 /*endfinally*/];
135
+ case 10: return [4 /*yield*/, manager.query("SET session_replication_role = 'origin';")];
136
+ case 11:
137
+ _d.sent();
138
+ return [2 /*return*/];
139
+ }
140
+ });
141
+ });
38
142
  },
39
- shutdown: async function (dbName) {
40
- await this.pgConnection_?.context?.destroy();
41
- await this.pgConnection_?.destroy();
42
- return await (0, pg_god_1.dropDatabase)({ databaseName: dbName, errorIfNonExist: false }, pgGodCredentials);
143
+ shutdown: function (dbName) {
144
+ var _a, _b, _c, _d;
145
+ return __awaiter(this, void 0, void 0, function () {
146
+ return __generator(this, function (_e) {
147
+ switch (_e.label) {
148
+ case 0: return [4 /*yield*/, ((_a = this.db_) === null || _a === void 0 ? void 0 : _a.destroy())];
149
+ case 1:
150
+ _e.sent();
151
+ return [4 /*yield*/, ((_c = (_b = this.pgConnection_) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.destroy())];
152
+ case 2:
153
+ _e.sent();
154
+ return [4 /*yield*/, ((_d = this.pgConnection_) === null || _d === void 0 ? void 0 : _d.destroy())];
155
+ case 3:
156
+ _e.sent();
157
+ return [4 /*yield*/, (0, pg_god_1.dropDatabase)({ databaseName: dbName, errorIfNonExist: false }, pgGodCredentials)];
158
+ case 4: return [2 /*return*/, _e.sent()];
159
+ }
160
+ });
161
+ });
43
162
  },
44
- });
45
- function medusaIntegrationTestRunner({ moduleName, dbName, schema = "public", env = {}, debug = false, testSuite, }) {
46
- const tempName = parseInt(process.env.JEST_WORKER_ID || "1");
47
- moduleName = moduleName ?? Math.random().toString(36).substring(7);
48
- dbName ??= `medusa-${moduleName.toLowerCase()}-integration-${tempName}`;
49
- let dbConfig = {
50
- dbName,
163
+ }); };
164
+ function medusaIntegrationTestRunner(_a) {
165
+ var _this = this;
166
+ var moduleName = _a.moduleName, dbName = _a.dbName, _b = _a.schema, schema = _b === void 0 ? "public" : _b, _c = _a.env, env = _c === void 0 ? {} : _c, _d = _a.force_modules_migration, force_modules_migration = _d === void 0 ? false : _d, _e = _a.debug, debug = _e === void 0 ? false : _e, testSuite = _a.testSuite;
167
+ var tempName = parseInt(process.env.JEST_WORKER_ID || "1");
168
+ moduleName = moduleName !== null && moduleName !== void 0 ? moduleName : Math.random().toString(36).substring(7);
169
+ dbName !== null && dbName !== void 0 ? dbName : (dbName = "medusa-".concat(moduleName.toLowerCase(), "-integration-").concat(tempName));
170
+ var dbConfig = {
171
+ dbName: dbName,
51
172
  clientUrl: (0, database_1.getDatabaseURL)(dbName),
52
- schema,
53
- debug,
173
+ schema: schema,
174
+ debug: debug,
54
175
  };
55
- const originalConfigLoader = require("@medusajs/medusa/dist/loaders/config").default;
56
- require("@medusajs/medusa/dist/loaders/config").default = (rootDirectory) => {
57
- const config = originalConfigLoader(rootDirectory);
58
- config.projectConfig.databaseUrl = dbConfig.clientUrl;
59
- config.projectConfig.databaseLogging = !!dbConfig.debug;
60
- config.projectConfig.databaseDriverOptions = dbConfig.clientUrl.includes("localhost")
61
- ? {}
62
- : {
63
- connection: {
64
- ssl: { rejectUnauthorized: false },
65
- },
66
- idle_in_transaction_session_timeout: 20000,
67
- };
176
+ var originalConfigLoader = require("@medusajs/medusa/dist/loaders/config").default;
177
+ require("@medusajs/medusa/dist/loaders/config").default = function (rootDirectory) {
178
+ var config = originalConfigLoader(rootDirectory);
179
+ config.projectConfig.database_url = dbConfig.clientUrl;
180
+ config.projectConfig.database_driver_options = dbConfig.clientUrl.includes("localhost") ? {} : {
181
+ connection: {
182
+ ssl: { rejectUnauthorized: false },
183
+ },
184
+ idle_in_transaction_session_timeout: 20000,
185
+ };
68
186
  return config;
69
187
  };
70
- const cwd = process.cwd();
71
- let shutdown = async () => void 0;
72
- const dbUtils = dbTestUtilFactory();
73
- let container;
74
- let apiUtils;
75
- let options = {
188
+ var cwd = process.cwd();
189
+ var shutdown = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
190
+ return [2 /*return*/, void 0];
191
+ }); }); };
192
+ var dbUtils = dbTestUtilFactory();
193
+ var container;
194
+ var apiUtils;
195
+ var options = {
196
+ dbUtils: dbUtils,
76
197
  api: new Proxy({}, {
77
- get: (target, prop) => {
198
+ get: function (target, prop) {
78
199
  return apiUtils[prop];
79
200
  },
80
201
  }),
81
202
  dbConnection: new Proxy({}, {
82
- get: (target, prop) => {
83
- return dbUtils.pgConnection_[prop];
203
+ get: function (target, prop) {
204
+ return dbUtils.db_[prop];
84
205
  },
85
206
  }),
86
- getContainer: () => container,
87
- dbConfig: {
88
- dbName,
89
- schema,
90
- clientUrl: dbConfig.clientUrl,
91
- },
92
- dbUtils,
207
+ getContainer: function () { return container; },
93
208
  };
94
- let isFirstTime = true;
95
- const beforeAll_ = async () => {
96
- console.log(`Creating database ${dbName}`);
97
- await dbUtils.create(dbName);
98
- try {
99
- dbUtils.pgConnection_ = await (0, use_db_1.initDb)({
100
- cwd,
101
- env,
102
- });
103
- }
104
- catch (error) {
105
- console.error("Error initializing database", error?.message);
106
- throw error;
107
- }
108
- let containerRes;
109
- let serverShutdownRes;
110
- let portRes;
111
- try {
112
- const { shutdown = () => void 0, container, port, } = await (0, bootstrap_app_1.startApp)({
113
- cwd,
114
- env,
115
- });
116
- containerRes = container;
117
- serverShutdownRes = shutdown;
118
- portRes = port;
119
- }
120
- catch (error) {
121
- console.error("Error starting the app", error?.message);
122
- throw error;
123
- }
124
- const cancelTokenSource = axios.CancelToken.source();
125
- container = containerRes;
126
- shutdown = async () => {
127
- await serverShutdownRes();
128
- cancelTokenSource.cancel("Request canceled by shutdown");
129
- };
130
- apiUtils = axios.create({
131
- baseURL: `http://localhost:${portRes}`,
132
- cancelToken: cancelTokenSource.token,
209
+ var isFirstTime = true;
210
+ var beforeAll_ = function () { return __awaiter(_this, void 0, void 0, function () {
211
+ var dataSourceRes, pgConnectionRes, _a, dbDataSource, pgConnection, error_1, containerRes, serverShutdownRes, portRes, _b, _c, shutdown_1, container_1, port, error_2, cancelTokenSource;
212
+ var _this = this;
213
+ return __generator(this, function (_d) {
214
+ switch (_d.label) {
215
+ case 0: return [4 /*yield*/, dbUtils.create(dbName)];
216
+ case 1:
217
+ _d.sent();
218
+ _d.label = 2;
219
+ case 2:
220
+ _d.trys.push([2, 4, , 5]);
221
+ return [4 /*yield*/, (0, use_db_1.initDb)({
222
+ cwd: cwd,
223
+ env: env,
224
+ force_modules_migration: force_modules_migration,
225
+ database_extra: {},
226
+ dbUrl: dbConfig.clientUrl,
227
+ dbSchema: dbConfig.schema,
228
+ })];
229
+ case 3:
230
+ _a = _d.sent(), dbDataSource = _a.dbDataSource, pgConnection = _a.pgConnection;
231
+ dataSourceRes = dbDataSource;
232
+ pgConnectionRes = pgConnection;
233
+ return [3 /*break*/, 5];
234
+ case 4:
235
+ error_1 = _d.sent();
236
+ console.error("Error initializing database", error_1 === null || error_1 === void 0 ? void 0 : error_1.message);
237
+ throw error_1;
238
+ case 5:
239
+ dbUtils.db_ = dataSourceRes;
240
+ dbUtils.pgConnection_ = pgConnectionRes;
241
+ _d.label = 6;
242
+ case 6:
243
+ _d.trys.push([6, 8, , 9]);
244
+ return [4 /*yield*/, (0, bootstrap_app_1.startBootstrapApp)({
245
+ cwd: cwd,
246
+ env: env,
247
+ })];
248
+ case 7:
249
+ _b = _d.sent(), _c = _b.shutdown, shutdown_1 = _c === void 0 ? function () { return void 0; } : _c, container_1 = _b.container, port = _b.port;
250
+ containerRes = container_1;
251
+ serverShutdownRes = shutdown_1;
252
+ portRes = port;
253
+ return [3 /*break*/, 9];
254
+ case 8:
255
+ error_2 = _d.sent();
256
+ console.error("Error starting the app", error_2 === null || error_2 === void 0 ? void 0 : error_2.message);
257
+ throw error_2;
258
+ case 9:
259
+ cancelTokenSource = axios.CancelToken.source();
260
+ container = containerRes;
261
+ shutdown = function () { return __awaiter(_this, void 0, void 0, function () {
262
+ return __generator(this, function (_a) {
263
+ switch (_a.label) {
264
+ case 0: return [4 /*yield*/, serverShutdownRes()];
265
+ case 1:
266
+ _a.sent();
267
+ cancelTokenSource.cancel("Request canceled by shutdown");
268
+ return [2 /*return*/];
269
+ }
270
+ });
271
+ }); };
272
+ apiUtils = axios.create({
273
+ baseURL: "http://localhost:".concat(portRes),
274
+ cancelToken: cancelTokenSource.token,
275
+ });
276
+ return [2 /*return*/];
277
+ }
133
278
  });
134
- };
135
- const beforeEach_ = async () => {
136
- // The beforeAll already run everything, so lets not re run the loaders for the first iteration
137
- if (isFirstTime) {
138
- isFirstTime = false;
139
- return;
140
- }
141
- const container = options.getContainer();
142
- const copiedContainer = (0, utils_1.createMedusaContainer)({}, container);
143
- try {
144
- const medusaAppLoaderRunner = require("@medusajs/medusa/dist/loaders/medusa-app").runModulesLoader;
145
- await medusaAppLoaderRunner({
146
- container: copiedContainer,
147
- configModule: container.resolve(utils_1.ContainerRegistrationKeys.CONFIG_MODULE),
148
- });
149
- }
150
- catch (error) {
151
- console.error("Error runner modules loaders", error?.message);
152
- throw error;
153
- }
154
- };
155
- const afterEach_ = async () => {
156
- try {
157
- await dbUtils.teardown({ schema });
158
- }
159
- catch (error) {
160
- console.error("Error tearing down database:", error?.message);
161
- throw error;
162
- }
163
- };
164
- return describe("", () => {
279
+ }); };
280
+ var beforeEach_ = function () { return __awaiter(_this, void 0, void 0, function () {
281
+ var container, copiedContainer, defaultLoader, error_3, medusaAppLoaderRunner, error_4;
282
+ return __generator(this, function (_a) {
283
+ switch (_a.label) {
284
+ case 0:
285
+ // The beforeAll already run everything, so lets not re run the loaders for the first iteration
286
+ if (isFirstTime) {
287
+ isFirstTime = false;
288
+ return [2 /*return*/];
289
+ }
290
+ container = options.getContainer();
291
+ copiedContainer = (0, utils_1.createMedusaContainer)({}, container);
292
+ if (!(process.env.MEDUSA_FF_MEDUSA_V2 != "true")) return [3 /*break*/, 4];
293
+ _a.label = 1;
294
+ case 1:
295
+ _a.trys.push([1, 3, , 4]);
296
+ defaultLoader = require("@medusajs/medusa/dist/loaders/defaults").default;
297
+ return [4 /*yield*/, defaultLoader({
298
+ container: copiedContainer,
299
+ })];
300
+ case 2:
301
+ _a.sent();
302
+ return [3 /*break*/, 4];
303
+ case 3:
304
+ error_3 = _a.sent();
305
+ console.error("Error runner medusa loaders", error_3 === null || error_3 === void 0 ? void 0 : error_3.message);
306
+ throw error_3;
307
+ case 4:
308
+ _a.trys.push([4, 6, , 7]);
309
+ medusaAppLoaderRunner = require("@medusajs/medusa/dist/loaders/medusa-app").runModulesLoader;
310
+ return [4 /*yield*/, medusaAppLoaderRunner({
311
+ container: copiedContainer,
312
+ configModule: container.resolve("configModule"),
313
+ })];
314
+ case 5:
315
+ _a.sent();
316
+ return [3 /*break*/, 7];
317
+ case 6:
318
+ error_4 = _a.sent();
319
+ console.error("Error runner modules loaders", error_4 === null || error_4 === void 0 ? void 0 : error_4.message);
320
+ throw error_4;
321
+ case 7: return [2 /*return*/];
322
+ }
323
+ });
324
+ }); };
325
+ var afterEach_ = function () { return __awaiter(_this, void 0, void 0, function () {
326
+ var error_5;
327
+ return __generator(this, function (_a) {
328
+ switch (_a.label) {
329
+ case 0:
330
+ _a.trys.push([0, 2, , 3]);
331
+ return [4 /*yield*/, dbUtils.teardown({ schema: schema })];
332
+ case 1:
333
+ _a.sent();
334
+ return [3 /*break*/, 3];
335
+ case 2:
336
+ error_5 = _a.sent();
337
+ console.error("Error tearing down database:", error_5 === null || error_5 === void 0 ? void 0 : error_5.message);
338
+ throw error_5;
339
+ case 3: return [2 /*return*/];
340
+ }
341
+ });
342
+ }); };
343
+ return describe("", function () {
165
344
  beforeAll(beforeAll_);
166
345
  beforeEach(beforeEach_);
167
346
  afterEach(afterEach_);
168
- afterAll(async () => {
169
- await dbUtils.shutdown(dbName);
170
- await shutdown();
171
- });
347
+ afterAll(function () { return __awaiter(_this, void 0, void 0, function () {
348
+ return __generator(this, function (_a) {
349
+ switch (_a.label) {
350
+ case 0: return [4 /*yield*/, dbUtils.shutdown(dbName)];
351
+ case 1:
352
+ _a.sent();
353
+ return [4 /*yield*/, shutdown()];
354
+ case 2:
355
+ _a.sent();
356
+ return [2 /*return*/];
357
+ }
358
+ });
359
+ }); });
172
360
  testSuite(options);
173
361
  });
174
362
  }
@@ -1 +1 @@
1
- {"version":3,"file":"medusa-test-runner.js","sourceRoot":"","sources":["../src/medusa-test-runner.ts"],"names":[],"mapp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BAAhB,SAAgB,CAAA;;;;aACjB,CAAC,CAAA;QAEF,SAAS,CAAC,OAAQ,CAAC,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC;AA/LD,kEA+LC"}
@@ -1,9 +1,8 @@
1
- import { EventBusTypes, IEventBusModuleService, Message, Subscriber } from "@medusajs/types";
1
+ import { EmitData, EventBusTypes, IEventBusModuleService, Message, Subscriber } from "@medusajs/types";
2
2
  export default class EventBusService implements IEventBusModuleService {
3
- emit<T>(data: Message<T> | Message<T>[], options: Record<string, unknown>): Promise<void>;
3
+ emit<T>(eventName: string, data: T, options?: Record<string, unknown>): Promise<void>;
4
+ emit<T>(data: EmitData<T>[]): Promise<void>;
5
+ emit<T>(data: Message<T>[]): Promise<void>;
4
6
  subscribe(event: string | symbol, subscriber: Subscriber): this;
5
7
  unsubscribe(event: string | symbol, subscriber: Subscriber, context?: EventBusTypes.SubscriberContext): this;
6
- releaseGroupedEvents(eventGroupId: string): Promise<void>;
7
- clearGroupedEvents(eventGroupId: string): Promise<void>;
8
8
  }
9
- //# sourceMappingURL=mock-event-bus-service.d.ts.map
@@ -1,19 +1,57 @@
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
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class EventBusService {
4
- async emit(data, options) { }
5
- subscribe(event, subscriber) {
6
- return this;
39
+ var EventBusService = /** @class */ (function () {
40
+ function EventBusService() {
7
41
  }
8
- unsubscribe(event, subscriber, context) {
42
+ EventBusService.prototype.emit = function (eventOrData, data, options) {
43
+ if (options === void 0) { options = {}; }
44
+ return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
45
+ return [2 /*return*/];
46
+ }); });
47
+ };
48
+ EventBusService.prototype.subscribe = function (event, subscriber) {
9
49
  return this;
10
- }
11
- releaseGroupedEvents(eventGroupId) {
12
- return Promise.resolve();
13
- }
14
- clearGroupedEvents(eventGroupId) {
15
- return Promise.resolve();
16
- }
17
- }
50
+ };
51
+ EventBusService.prototype.unsubscribe = function (event, subscriber, context) {
52
+ return this;
53
+ };
54
+ return EventBusService;
55
+ }());
18
56
  exports.default = EventBusService;
19
57
  //# sourceMappingURL=mock-event-bus-service.js.map