medusa-test-utils 1.1.45-preview-20240516103804 → 1.1.45-snapshot-20240516152256
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/events.d.ts +2 -0
- package/dist/events.js +71 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/module-test-runner.js +1 -1
- package/dist/module-test-runner.js.map +1 -1
- package/package.json +6 -6
package/dist/events.d.ts
ADDED
package/dist/events.js
ADDED
@@ -0,0 +1,71 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
+
exports.waitSubscribersExecution = void 0;
|
40
|
+
// Allows you to wait for all subscribers to execute for a given event. Only works with the local event bus.
|
41
|
+
var waitSubscribersExecution = function (eventName, eventBus) {
|
42
|
+
var subscriberPromises = [];
|
43
|
+
eventBus.eventEmitter_.listeners(eventName).forEach(function (listener) {
|
44
|
+
;
|
45
|
+
eventBus.eventEmitter_.removeListener("order.created", listener);
|
46
|
+
var ok, nok;
|
47
|
+
var promise = new Promise(function (resolve, reject) {
|
48
|
+
ok = resolve;
|
49
|
+
nok = reject;
|
50
|
+
});
|
51
|
+
subscriberPromises.push(promise);
|
52
|
+
var newListener = function () {
|
53
|
+
var args2 = [];
|
54
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
55
|
+
args2[_i] = arguments[_i];
|
56
|
+
}
|
57
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
58
|
+
return __generator(this, function (_a) {
|
59
|
+
switch (_a.label) {
|
60
|
+
case 0: return [4 /*yield*/, listener.apply(eventBus, args2).then(ok).catch(nok)];
|
61
|
+
case 1: return [2 /*return*/, _a.sent()];
|
62
|
+
}
|
63
|
+
});
|
64
|
+
});
|
65
|
+
};
|
66
|
+
eventBus.eventEmitter_.on("order.created", newListener);
|
67
|
+
});
|
68
|
+
return Promise.all(subscriberPromises);
|
69
|
+
};
|
70
|
+
exports.waitSubscribersExecution = waitSubscribersExecution;
|
71
|
+
//# sourceMappingURL=events.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4GAA4G;AACrG,IAAM,wBAAwB,GAAG,UACtC,SAAiB,EACjB,QAAgC;IAEhC,IAAM,kBAAkB,GAAmB,EAAE,CAE5C;IAAC,QAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAC,QAAQ;QACrE,CAAC;QAAC,QAAgB,CAAC,aAAa,CAAC,cAAc,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;QAE1E,IAAI,EAAE,EAAE,GAAG,CAAA;QACX,IAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC1C,EAAE,GAAG,OAAO,CAAA;YACZ,GAAG,GAAG,MAAM,CAAA;QACd,CAAC,CAAC,CAAA;QACF,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAEhC,IAAM,WAAW,GAAG;YAAO,eAAQ;iBAAR,UAAQ,EAAR,qBAAQ,EAAR,IAAQ;gBAAR,0BAAQ;;;;;gCAC1B,qBAAM,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAA;gCAAhE,sBAAO,SAAyD,EAAA;;;;SACjE,CAEA;QAAC,QAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IACnE,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AACxC,CAAC,CAAA;AAxBY,QAAA,wBAAwB,4BAwBpC"}
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export * as TestDatabaseUtils from "./database";
|
2
|
-
export
|
2
|
+
export * as TestEventUtils from "./events";
|
3
3
|
export * as JestUtils from "./jest";
|
4
|
+
export { default as IdMap } from "./id-map";
|
4
5
|
export { default as MockManager } from "./mock-manager";
|
5
6
|
export { default as MockRepository } from "./mock-repository";
|
6
7
|
export * from "./init-modules";
|
package/dist/index.js
CHANGED
@@ -29,11 +29,12 @@ 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.
|
32
|
+
exports.MockEventBusService = exports.MockRepository = exports.MockManager = exports.IdMap = exports.JestUtils = exports.TestEventUtils = exports.TestDatabaseUtils = void 0;
|
33
33
|
exports.TestDatabaseUtils = __importStar(require("./database"));
|
34
|
+
exports.TestEventUtils = __importStar(require("./events"));
|
35
|
+
exports.JestUtils = __importStar(require("./jest"));
|
34
36
|
var id_map_1 = require("./id-map");
|
35
37
|
Object.defineProperty(exports, "IdMap", { enumerable: true, get: function () { return __importDefault(id_map_1).default; } });
|
36
|
-
exports.JestUtils = __importStar(require("./jest"));
|
37
38
|
var mock_manager_1 = require("./mock-manager");
|
38
39
|
Object.defineProperty(exports, "MockManager", { enumerable: true, get: function () { return __importDefault(mock_manager_1).default; } });
|
39
40
|
var mock_repository_1 = require("./mock-repository");
|
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
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA+C;AAC/C,2DAA0C;AAC1C,oDAAmC;AACnC,mCAA2C;AAAlC,gHAAA,OAAO,OAAS;AACzB,+CAAuD;AAA9C,4HAAA,OAAO,OAAe;AAC/B,qDAA6D;AAApD,kIAAA,OAAO,OAAkB;AAClC,iDAA8B;AAC9B,mEAAyE;AAAhE,8IAAA,OAAO,OAAuB;AACvC,uDAAoC;AACpC,uDAAoC"}
|
@@ -84,7 +84,7 @@ function moduleIntegrationTestRunner(_a) {
|
|
84
84
|
},
|
85
85
|
_b);
|
86
86
|
var moduleOptions_ = {
|
87
|
-
injectedDependencies: __assign((_c = {}, _c[utils_1.ContainerRegistrationKeys.PG_CONNECTION] = connection, _c
|
87
|
+
injectedDependencies: __assign((_c = {}, _c[utils_1.ContainerRegistrationKeys.PG_CONNECTION] = connection, _c["eventBusModuleService"] = new _1.MockEventBusService(), _c[utils_1.ContainerRegistrationKeys.LOGGER] = console, _c), injectedDependencies),
|
88
88
|
modulesConfig: modulesConfig_,
|
89
89
|
databaseConfig: dbConfig,
|
90
90
|
joinerConfig: joinerConfig,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"module-test-runner.js","sourceRoot":"","sources":["../src/module-test-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAChE,uCAA6E;AAE7E,sBAAuC;AACvC,yCAA4E;AAY5E,SAAgB,2BAA2B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-
|
3
|
+
"version": "1.1.45-snapshot-20240516152256",
|
4
4
|
"description": "Test utils for Medusa",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"repository": {
|
@@ -24,15 +24,15 @@
|
|
24
24
|
"author": "Sebastian Rindom",
|
25
25
|
"license": "MIT",
|
26
26
|
"devDependencies": {
|
27
|
-
"@medusajs/types": "1.12.0-
|
27
|
+
"@medusajs/types": "1.12.0-snapshot-20240516152256",
|
28
28
|
"cross-env": "^5.2.1",
|
29
29
|
"jest": "^25.5.4",
|
30
30
|
"rimraf": "^3.0.2",
|
31
31
|
"typescript": "^5.1.6"
|
32
32
|
},
|
33
33
|
"peerDependencies": {
|
34
|
-
"@medusajs/medusa": "1.20.6-
|
35
|
-
"@medusajs/modules-sdk": "1.13.0-
|
34
|
+
"@medusajs/medusa": "1.20.6-snapshot-20240516152256",
|
35
|
+
"@medusajs/modules-sdk": "1.13.0-snapshot-20240516152256",
|
36
36
|
"axios": "^0.28.0",
|
37
37
|
"express": "^4.18.3",
|
38
38
|
"get-port": "^5.1.0",
|
@@ -60,10 +60,10 @@
|
|
60
60
|
}
|
61
61
|
},
|
62
62
|
"dependencies": {
|
63
|
-
"@medusajs/utils": "1.12.0-
|
63
|
+
"@medusajs/utils": "1.12.0-snapshot-20240516152256",
|
64
64
|
"@mikro-orm/migrations": "5.9.7",
|
65
65
|
"@mikro-orm/postgresql": "5.9.7",
|
66
|
-
"medusa-core-utils": "1.2.3-
|
66
|
+
"medusa-core-utils": "1.2.3-snapshot-20240516152256",
|
67
67
|
"randomatic": "^3.1.1"
|
68
68
|
},
|
69
69
|
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808"
|