@iobroker/testing 5.0.2 → 5.0.3
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.
|
@@ -38,8 +38,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.AdapterSetup = void 0;
|
|
40
40
|
// Add debug logging for tests
|
|
41
|
-
// @ts-expect-error no types
|
|
42
|
-
const objects_1 = require("alcalzone-shared/objects");
|
|
43
41
|
const debug_1 = __importDefault(require("debug"));
|
|
44
42
|
const fs_extra_1 = require("fs-extra");
|
|
45
43
|
const path = __importStar(require("path"));
|
|
@@ -100,7 +98,7 @@ class AdapterSetup {
|
|
|
100
98
|
const packageJsonPath = path.join(this.testDir, 'package.json');
|
|
101
99
|
const packageJson = await (0, fs_extra_1.readJSON)(packageJsonPath);
|
|
102
100
|
packageJson.dependencies[this.adapterFullName] = `file:./${tarballName}`;
|
|
103
|
-
for (const [dep, version] of
|
|
101
|
+
for (const [dep, version] of Object.entries((0, adapterTools_1.getAdapterDependencies)(this.adapterDir))) {
|
|
104
102
|
// Don't overwrite the js-controller GitHub dependency with a probably lower one
|
|
105
103
|
if (dep === 'js-controller') {
|
|
106
104
|
continue;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAdapterMock = createAdapterMock;
|
|
4
|
-
// @ts-expect-error no types
|
|
5
4
|
const objects_1 = require("alcalzone-shared/objects");
|
|
6
5
|
const sinon_1 = require("sinon");
|
|
7
6
|
const mockLogger_1 = require("./mockLogger");
|
|
@@ -159,7 +158,7 @@ function createAdapterMock(db, options = {}) {
|
|
|
159
158
|
}
|
|
160
159
|
const callback = getCallback(...args);
|
|
161
160
|
if (typeof callback === 'function') {
|
|
162
|
-
let objects =
|
|
161
|
+
let objects = Object.values(db.getObjects('*'));
|
|
163
162
|
objects = objects.filter(obj => obj.type === search);
|
|
164
163
|
if (startkey) {
|
|
165
164
|
objects = objects.filter(obj => obj._id >= startkey);
|
|
@@ -178,7 +177,7 @@ function createAdapterMock(db, options = {}) {
|
|
|
178
177
|
getObjectList: (({ startkey, endkey, include_docs, }, ...args) => {
|
|
179
178
|
const callback = getCallback(...args);
|
|
180
179
|
if (typeof callback === 'function') {
|
|
181
|
-
let objects =
|
|
180
|
+
let objects = Object.values(db.getObjects('*'));
|
|
182
181
|
if (startkey) {
|
|
183
182
|
objects = objects.filter(obj => obj._id >= startkey);
|
|
184
183
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MockDatabase = void 0;
|
|
4
4
|
exports.createAsserts = createAsserts;
|
|
5
|
-
// @ts-expect-error no types
|
|
6
5
|
const objects_1 = require("alcalzone-shared/objects");
|
|
7
6
|
const str2regex_1 = require("../../../lib/str2regex");
|
|
8
7
|
const objectTemplate = Object.freeze({
|
|
@@ -113,14 +112,14 @@ class MockDatabase {
|
|
|
113
112
|
pattern = namespaceOrPattern;
|
|
114
113
|
}
|
|
115
114
|
const idRegExp = (0, str2regex_1.str2regex)(pattern);
|
|
116
|
-
return
|
|
115
|
+
return Object.fromEntries([...this.objects.entries()]
|
|
117
116
|
.filter(([id]) => idRegExp.test(id))
|
|
118
117
|
.filter(([, obj]) => type == null || obj.type === type));
|
|
119
118
|
}
|
|
120
119
|
getStates(pattern) {
|
|
121
120
|
// combines getStates and getForeignStates into one
|
|
122
121
|
const idRegExp = (0, str2regex_1.str2regex)(pattern);
|
|
123
|
-
return
|
|
122
|
+
return Object.fromEntries([...this.states.entries()].filter(([id]) => idRegExp.test(id)));
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
exports.MockDatabase = MockDatabase;
|