@luvio/adapter-test-library 0.62.2 → 0.63.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.
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sinon'), require('@luvio/environments')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'sinon', '@luvio/environments'], factory) :
|
|
4
|
-
(global = global || self, factory(global.luvioAdapterTestLibrary = {}, global.sinon, global.environments));
|
|
5
|
-
}(this, (function (exports, sinon, environments) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.luvioAdapterTestLibrary = {}, global.sinon, global.environments));
|
|
5
|
+
})(this, (function (exports, sinon, environments) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var sinon__default = /*#__PURE__*/_interopDefaultLegacy(sinon);
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Clone an object
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
const networkConnectivityStateMap = new WeakMap();
|
|
62
|
+
exports.ConnectivityState = void 0;
|
|
60
63
|
(function (ConnectivityState) {
|
|
61
64
|
ConnectivityState[ConnectivityState["Online"] = 0] = "Online";
|
|
62
65
|
ConnectivityState[ConnectivityState["Offline"] = 1] = "Offline";
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
}
|
|
101
104
|
function buildMockNetworkAdapter(mockPayloads) {
|
|
102
105
|
// any endpoints not setup with a fake will return a rejected promise
|
|
103
|
-
const networkAdapter =
|
|
106
|
+
const networkAdapter = sinon__default["default"].stub().rejects(buildMockSetupError());
|
|
104
107
|
callCountMap.set(networkAdapter, 0);
|
|
105
108
|
mockPayloadsMap.set(networkAdapter, mockPayloads);
|
|
106
109
|
setMockNetworkPayloads(networkAdapter, mockPayloads);
|
|
@@ -136,7 +139,7 @@
|
|
|
136
139
|
// sort mock payloads so least-specific network args are registered first
|
|
137
140
|
mockPayloads.sort(sortPayloads).forEach((mockPayload) => {
|
|
138
141
|
const { networkArgs, response } = mockPayload;
|
|
139
|
-
const args =
|
|
142
|
+
const args = sinon__default["default"].match(networkArgs);
|
|
140
143
|
stub.withArgs(args).callsFake(() => {
|
|
141
144
|
return onNetworkStubCalled(stub, response);
|
|
142
145
|
});
|
|
@@ -158,7 +161,7 @@
|
|
|
158
161
|
function overrideMockNetworkResponses(mockNetworkAdapter, responses) {
|
|
159
162
|
const stub = mockNetworkAdapter;
|
|
160
163
|
let index = 0;
|
|
161
|
-
stub.withArgs(
|
|
164
|
+
stub.withArgs(sinon__default["default"].match.any).callsFake(() => {
|
|
162
165
|
const response = responses[index++];
|
|
163
166
|
if (response === undefined) {
|
|
164
167
|
// if they have more requests than expected
|
|
@@ -383,4 +386,4 @@
|
|
|
383
386
|
|
|
384
387
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
385
388
|
|
|
386
|
-
}))
|
|
389
|
+
}));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sinon'), require('@luvio/environments')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'sinon', '@luvio/environments'], factory) :
|
|
4
|
-
(global = global || self, factory(global.luvioAdapterTestLibrary = {}, global.sinon, global.environments));
|
|
5
|
-
}(this, (function (exports, sinon, environments) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.luvioAdapterTestLibrary = {}, global.sinon, global.environments));
|
|
5
|
+
})(this, (function (exports, sinon, environments) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var sinon__default = /*#__PURE__*/_interopDefaultLegacy(sinon);
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Clone an object
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
var networkConnectivityStateMap = new WeakMap();
|
|
62
|
+
exports.ConnectivityState = void 0;
|
|
60
63
|
(function (ConnectivityState) {
|
|
61
64
|
ConnectivityState[ConnectivityState["Online"] = 0] = "Online";
|
|
62
65
|
ConnectivityState[ConnectivityState["Offline"] = 1] = "Offline";
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
}
|
|
101
104
|
function buildMockNetworkAdapter(mockPayloads) {
|
|
102
105
|
// any endpoints not setup with a fake will return a rejected promise
|
|
103
|
-
var networkAdapter =
|
|
106
|
+
var networkAdapter = sinon__default["default"].stub().rejects(buildMockSetupError());
|
|
104
107
|
callCountMap.set(networkAdapter, 0);
|
|
105
108
|
mockPayloadsMap.set(networkAdapter, mockPayloads);
|
|
106
109
|
setMockNetworkPayloads(networkAdapter, mockPayloads);
|
|
@@ -136,7 +139,7 @@
|
|
|
136
139
|
// sort mock payloads so least-specific network args are registered first
|
|
137
140
|
mockPayloads.sort(sortPayloads).forEach(function (mockPayload) {
|
|
138
141
|
var networkArgs = mockPayload.networkArgs, response = mockPayload.response;
|
|
139
|
-
var args =
|
|
142
|
+
var args = sinon__default["default"].match(networkArgs);
|
|
140
143
|
stub.withArgs(args).callsFake(function () {
|
|
141
144
|
return onNetworkStubCalled(stub, response);
|
|
142
145
|
});
|
|
@@ -158,7 +161,7 @@
|
|
|
158
161
|
function overrideMockNetworkResponses(mockNetworkAdapter, responses) {
|
|
159
162
|
var stub = mockNetworkAdapter;
|
|
160
163
|
var index = 0;
|
|
161
|
-
stub.withArgs(
|
|
164
|
+
stub.withArgs(sinon__default["default"].match.any).callsFake(function () {
|
|
162
165
|
var response = responses[index++];
|
|
163
166
|
if (response === undefined) {
|
|
164
167
|
// if they have more requests than expected
|
|
@@ -393,4 +396,4 @@
|
|
|
393
396
|
|
|
394
397
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
395
398
|
|
|
396
|
-
}))
|
|
399
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/adapter-test-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.1",
|
|
4
4
|
"description": "Test library for luvio adapters",
|
|
5
5
|
"main": "dist/umd/es2018/test-library.js",
|
|
6
6
|
"module": "dist/es/es2018/test-library.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test": "jest"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@luvio/engine": "0.
|
|
17
|
-
"@luvio/environments": "0.
|
|
16
|
+
"@luvio/engine": "0.63.1",
|
|
17
|
+
"@luvio/environments": "0.63.1",
|
|
18
18
|
"@types/sinon": "^7.5.2"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|