@appium/test-support 4.0.0-rc.1 → 4.0.1
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.
package/build/lib/mock-utils.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
var _MockStore_mocks;
|
|
17
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
6
|
exports.MockStore = void 0;
|
|
19
7
|
exports.withMocks = withMocks;
|
|
@@ -57,30 +45,35 @@ function verifyMocks(mocks) {
|
|
|
57
45
|
* @extends {Mocks}
|
|
58
46
|
*/
|
|
59
47
|
class MockStore {
|
|
48
|
+
/**
|
|
49
|
+
* Temporary sandbox; will be `undefined` until `beforeEach` is called
|
|
50
|
+
* @type {SinonSandbox|undefined}
|
|
51
|
+
*/
|
|
52
|
+
sandbox;
|
|
53
|
+
/**
|
|
54
|
+
* Original k/v pair provided to `createMocks`
|
|
55
|
+
* @type {Mocks|undefined}
|
|
56
|
+
*/
|
|
57
|
+
#mocks;
|
|
60
58
|
/**
|
|
61
59
|
* Uses a sandbox if one is provided
|
|
62
60
|
* @param {SinonSandbox} [sandbox]
|
|
63
61
|
*/
|
|
64
62
|
constructor(sandbox) {
|
|
65
|
-
/**
|
|
66
|
-
* Original k/v pair provided to `createMocks`
|
|
67
|
-
* @type {Mocks|undefined}
|
|
68
|
-
*/
|
|
69
|
-
_MockStore_mocks.set(this, void 0);
|
|
70
63
|
this.sandbox = sandbox;
|
|
71
64
|
}
|
|
72
65
|
/**
|
|
73
66
|
* @param {Mocks} mockDefs
|
|
74
67
|
*/
|
|
75
68
|
createMocks(mockDefs) {
|
|
76
|
-
if (
|
|
69
|
+
if (this.#mocks) {
|
|
77
70
|
throw new ReferenceError('Cannot create mocks twice; call `reset()` first.');
|
|
78
71
|
}
|
|
79
72
|
this.sandbox = this.sandbox ?? sinon_1.default.createSandbox();
|
|
80
73
|
for (const [key, value] of Object.entries(mockDefs)) {
|
|
81
74
|
this[key] = this.sandbox.mock(value);
|
|
82
75
|
}
|
|
83
|
-
|
|
76
|
+
this.#mocks = mockDefs;
|
|
84
77
|
return this;
|
|
85
78
|
}
|
|
86
79
|
/**
|
|
@@ -93,15 +86,14 @@ class MockStore {
|
|
|
93
86
|
this.sandbox.verify();
|
|
94
87
|
}
|
|
95
88
|
reset() {
|
|
96
|
-
for (const key of Object.keys(
|
|
89
|
+
for (const key of Object.keys(this.#mocks ?? {})) {
|
|
97
90
|
delete this[key];
|
|
98
91
|
}
|
|
99
92
|
this.sandbox?.restore();
|
|
100
|
-
|
|
93
|
+
this.#mocks = undefined;
|
|
101
94
|
}
|
|
102
95
|
}
|
|
103
96
|
exports.MockStore = MockStore;
|
|
104
|
-
_MockStore_mocks = new WeakMap();
|
|
105
97
|
/**
|
|
106
98
|
* @typedef {import('sinon').SinonSandbox} SinonSandbox
|
|
107
99
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-utils.js","sourceRoot":"","sources":["../../lib/mock-utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-utils.js","sourceRoot":"","sources":["../../lib/mock-utils.js"],"names":[],"mappings":";;;;;;AAcA,8BAaC;AAMD,kCAEC;AAnCD,kDAA0B;AAE1B;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,QAAQ,EAAE,EAAE;IACpC,OAAO,GAAG,EAAE;QACV,MAAM,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;QAC9B,oDAAoD;QACpD,UAAU,CAAC,SAAS,mBAAmB;YACrC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,oDAAoD;QACpD,SAAS,CAAC,SAAS,kBAAkB;YACnC,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,KAAK,CAAC,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAK;IAC/B,KAAK,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAa,SAAS;IACpB;;;OAGG;IACH,OAAO,CAAC;IAER;;;OAGG;IACH,MAAM,CAAC;IAEP;;;OAGG;IACH,YAAY,OAAO;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAQ;QAClB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,cAAc,CAAC,kDAAkD,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,eAAK,CAAC,aAAa,EAAE,CAAC;QACrD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,cAAc,CACtB,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;IAED,KAAK;QACH,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;CACF;AAvDD,8BAuDC;AAED;;GAEG"}
|
|
@@ -45,6 +45,10 @@ function verifySandbox(sbxOrMocks) {
|
|
|
45
45
|
* @template {Record<string,any>} Mocks
|
|
46
46
|
*/
|
|
47
47
|
class SandboxStore {
|
|
48
|
+
/** @type {MockStore<Record<string,any>>} */
|
|
49
|
+
mocks;
|
|
50
|
+
/** @type {SinonSandbox|undefined} */
|
|
51
|
+
sandbox;
|
|
48
52
|
/**
|
|
49
53
|
* Uses a sandbox if one is provided
|
|
50
54
|
* @param {SinonSandbox} [sandbox]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-utils.js","sourceRoot":"","sources":["../../lib/sandbox-utils.js"],"names":[],"mappings":";;;;;;AAUA,kCAkBC;AAMD,sCAEC;AApCD,kDAA0B;AAC1B,oDAAuB;A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.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "A collection of test utilities used across Appium packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@appium/support": "^7.0.
|
|
48
|
+
"@appium/support": "^7.0.1",
|
|
49
49
|
"@colors/colors": "1.6.0",
|
|
50
50
|
"bluebird": "3.7.2",
|
|
51
51
|
"lodash": "4.17.21",
|
|
@@ -58,8 +58,7 @@
|
|
|
58
58
|
"npm": ">=10"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
|
-
"access": "public"
|
|
62
|
-
"tag": "rc"
|
|
61
|
+
"access": "public"
|
|
63
62
|
},
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "606e4c1f58fa68d96c04be4313ccab86ccd48361"
|
|
65
64
|
}
|