@sebbo2002/node-pyatv 4.3.4-develop.4 → 5.1.0-develop.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/.mocharc.yml +3 -3
- package/.nycrc +1 -0
- package/CHANGELOG.md +31 -0
- package/dist/bin/check.js +2 -6
- package/dist/bin/check.js.map +1 -1
- package/dist/examples/push.js +2 -6
- package/dist/examples/push.js.map +1 -1
- package/dist/lib/device-event.d.ts +2 -2
- package/dist/lib/device-event.js +1 -3
- package/dist/lib/device-event.js.map +1 -1
- package/dist/lib/device-events.d.ts +2 -2
- package/dist/lib/device-events.js +38 -40
- package/dist/lib/device-events.js.map +1 -1
- package/dist/lib/device.d.ts +47 -2
- package/dist/lib/device.js +99 -46
- package/dist/lib/device.js.map +1 -1
- package/dist/lib/fake-spawn.js +7 -14
- package/dist/lib/fake-spawn.js.map +1 -1
- package/dist/lib/index.d.ts +6 -5
- package/dist/lib/index.js +6 -22
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/instance.d.ts +2 -2
- package/dist/lib/instance.js +40 -32
- package/dist/lib/instance.js.map +1 -1
- package/dist/lib/tools.d.ts +1 -1
- package/dist/lib/tools.js +24 -34
- package/dist/lib/tools.js.map +1 -1
- package/dist/lib/types.d.ts +24 -0
- package/dist/lib/types.js +20 -23
- package/dist/lib/types.js.map +1 -1
- package/docs/coverage/block-navigation.js +8 -0
- package/docs/coverage/cobertura-coverage.xml +2818 -1534
- package/docs/coverage/device-event.ts.html +64 -59
- package/docs/coverage/device-events.ts.html +215 -210
- package/docs/coverage/device.ts.html +931 -740
- package/docs/coverage/fake-spawn.ts.html +102 -97
- package/docs/coverage/favicon.png +0 -0
- package/docs/coverage/index.html +74 -69
- package/docs/coverage/index.ts.html +63 -49
- package/docs/coverage/instance.ts.html +256 -224
- package/docs/coverage/sort-arrow-sprite.png +0 -0
- package/docs/coverage/sorter.js +26 -0
- package/docs/coverage/tools.ts.html +310 -305
- package/docs/coverage/types.ts.html +204 -121
- package/docs/reference/assets/highlight.css +11 -25
- package/docs/reference/assets/main.js +4 -2
- package/docs/reference/assets/search.js +1 -1
- package/docs/reference/assets/style.css +424 -538
- package/docs/reference/classes/NodePyATVDevice.html +1136 -126
- package/docs/reference/classes/NodePyATVDeviceEvent.html +111 -10
- package/docs/reference/classes/NodePyATVInstance.html +227 -0
- package/docs/reference/enums/NodePyATVDeviceState.html +93 -1
- package/docs/reference/enums/NodePyATVExecutableType.html +65 -0
- package/docs/reference/enums/NodePyATVKeys.html +212 -1
- package/docs/reference/enums/NodePyATVListenerState.html +79 -1
- package/docs/reference/enums/NodePyATVMediaType.html +79 -1
- package/docs/reference/enums/NodePyATVPowerState.html +65 -1
- package/docs/reference/enums/NodePyATVProtocol.html +79 -1
- package/docs/reference/enums/NodePyATVRepeatState.html +72 -1
- package/docs/reference/enums/NodePyATVShuffleState.html +72 -1
- package/docs/reference/index.html +61 -53
- package/docs/reference/interfaces/NodePyATVDeviceOptions.html +229 -1
- package/docs/reference/interfaces/NodePyATVFindAndInstanceOptions.html +190 -1
- package/docs/reference/interfaces/NodePyATVFindOptions.html +120 -1
- package/docs/reference/interfaces/NodePyATVGetStateOptions.html +62 -1
- package/docs/reference/interfaces/NodePyATVInstanceOptions.html +110 -1
- package/docs/reference/interfaces/NodePyATVService.html +69 -0
- package/docs/reference/interfaces/NodePyATVState.html +160 -1
- package/docs/reference/interfaces/NodePyATVVersionResponse.html +69 -1
- package/docs/reference/modules.html +104 -1
- package/docs/reference/types/NodePyATVEventValueType.html +64 -0
- package/docs/tests/index.html +1 -1
- package/docs/tests/mochawesome.json +1074 -784
- package/package.json +18 -15
- package/release.config.cjs +56 -0
- package/src/bin/check.ts +1 -1
- package/src/examples/push.ts +1 -1
- package/src/lib/device-event.ts +2 -2
- package/src/lib/device-events.ts +4 -4
- package/src/lib/device.ts +65 -3
- package/src/lib/index.ts +20 -17
- package/src/lib/instance.ts +31 -22
- package/src/lib/tools.ts +1 -1
- package/src/lib/types.ts +26 -0
- package/test/device-event.ts +2 -2
- package/test/device-events.ts +2 -2
- package/test/device.ts +127 -4
- package/test/instance.ts +128 -42
- package/test/tools.ts +2 -2
- package/tsconfig.json +1 -1
- package/docs/reference/assets/icons.css +0 -1043
- package/docs/reference/assets/icons.png +0 -0
- package/docs/reference/assets/icons@2x.png +0 -0
- package/docs/reference/classes/default.html +0 -50
package/test/device.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import assert from 'assert';
|
|
4
|
-
import NodePyATVDevice from '../src/lib/device';
|
|
4
|
+
import NodePyATVDevice from '../src/lib/device.js';
|
|
5
5
|
import {
|
|
6
6
|
NodePyATVDeviceState,
|
|
7
7
|
NodePyATVKeys,
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
NodePyATVProtocol,
|
|
10
10
|
NodePyATVRepeatState,
|
|
11
11
|
NodePyATVShuffleState
|
|
12
|
-
} from '../src/lib/types';
|
|
13
|
-
import NodePyATVInstance from '../src/lib/instance';
|
|
14
|
-
import {createFakeSpawn} from '../src/lib/fake-spawn';
|
|
12
|
+
} from '../src/lib/types.js';
|
|
13
|
+
import NodePyATVInstance from '../src/lib/instance.js';
|
|
14
|
+
import { createFakeSpawn } from '../src/lib/fake-spawn.js';
|
|
15
15
|
|
|
16
16
|
describe('NodePyATVDevice', function () {
|
|
17
17
|
describe('get name()', function () {
|
|
@@ -60,6 +60,129 @@ describe('NodePyATVDevice', function () {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
describe('get model()', function () {
|
|
64
|
+
it('should return the model if set by scan', function () {
|
|
65
|
+
const device = new NodePyATVDevice({
|
|
66
|
+
name: 'Vardagsrum',
|
|
67
|
+
host: '10.0.10.81',
|
|
68
|
+
id: 'xxx',
|
|
69
|
+
model: 'Gen4K'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
assert.strictEqual(device.model, 'Gen4K');
|
|
73
|
+
});
|
|
74
|
+
it('should return undefined otherwise', function () {
|
|
75
|
+
const device = new NodePyATVDevice({
|
|
76
|
+
name: 'Vardagsrum',
|
|
77
|
+
host: '10.0.10.81'
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
assert.strictEqual(device.model, undefined);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('get modelName()', function () {
|
|
85
|
+
it('should return the model name if set by scan', function () {
|
|
86
|
+
const device = new NodePyATVDevice({
|
|
87
|
+
name: 'Vardagsrum',
|
|
88
|
+
host: '10.0.10.81',
|
|
89
|
+
id: 'xxx',
|
|
90
|
+
modelName: 'Apple TV 4K'
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
assert.strictEqual(device.modelName, 'Apple TV 4K');
|
|
94
|
+
});
|
|
95
|
+
it('should return undefined otherwise', function () {
|
|
96
|
+
const device = new NodePyATVDevice({
|
|
97
|
+
name: 'Vardagsrum',
|
|
98
|
+
host: '10.0.10.81'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
assert.strictEqual(device.modelName, undefined);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('get os()', function () {
|
|
106
|
+
it('should return the operating system if set by scan', function () {
|
|
107
|
+
const device = new NodePyATVDevice({
|
|
108
|
+
name: 'Vardagsrum',
|
|
109
|
+
host: '10.0.10.81',
|
|
110
|
+
id: 'xxx',
|
|
111
|
+
os: 'TvOS'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
assert.strictEqual(device.os, 'TvOS');
|
|
115
|
+
});
|
|
116
|
+
it('should return undefined otherwise', function () {
|
|
117
|
+
const device = new NodePyATVDevice({
|
|
118
|
+
name: 'Vardagsrum',
|
|
119
|
+
host: '10.0.10.81'
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
assert.strictEqual(device.os, undefined);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('get version()', function () {
|
|
127
|
+
it('should return the version if set by scan', function () {
|
|
128
|
+
const device = new NodePyATVDevice({
|
|
129
|
+
name: 'Vardagsrum',
|
|
130
|
+
host: '10.0.10.81',
|
|
131
|
+
id: 'xxx',
|
|
132
|
+
version: '15.5.1'
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
assert.strictEqual(device.version, '15.5.1');
|
|
136
|
+
});
|
|
137
|
+
it('should return undefined otherwise', function () {
|
|
138
|
+
const device = new NodePyATVDevice({
|
|
139
|
+
name: 'Vardagsrum',
|
|
140
|
+
host: '10.0.10.81'
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
assert.strictEqual(device.version, undefined);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('get services()', function () {
|
|
148
|
+
it('should return the services if set by scan', function () {
|
|
149
|
+
const device = new NodePyATVDevice({
|
|
150
|
+
name: 'Vardagsrum',
|
|
151
|
+
host: '10.0.10.81',
|
|
152
|
+
id: 'xxx',
|
|
153
|
+
services: [
|
|
154
|
+
{
|
|
155
|
+
protocol: NodePyATVProtocol.mrp,
|
|
156
|
+
port: 49152
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
protocol: NodePyATVProtocol.airplay,
|
|
160
|
+
port: 7000
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
assert.deepStrictEqual(device.services, [
|
|
166
|
+
{
|
|
167
|
+
protocol: 'mrp',
|
|
168
|
+
port: 49152
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
protocol: 'airplay',
|
|
172
|
+
port: 7000
|
|
173
|
+
}
|
|
174
|
+
]);
|
|
175
|
+
});
|
|
176
|
+
it('should return undefined otherwise', function () {
|
|
177
|
+
const device = new NodePyATVDevice({
|
|
178
|
+
name: 'Vardagsrum',
|
|
179
|
+
host: '10.0.10.81'
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
assert.strictEqual(device.services, undefined);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
63
186
|
describe('get debug()', function () {
|
|
64
187
|
it('should return true if set to true', function () {
|
|
65
188
|
const device = new NodePyATVDevice({
|
package/test/instance.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import assert from 'assert';
|
|
4
|
-
import {
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
import { createFakeSpawn } from '../src/lib/fake-spawn.js';
|
|
5
9
|
import NodePyATVInstance, {
|
|
6
|
-
NodePyATVProtocol,
|
|
7
|
-
NodePyATVMediaType,
|
|
8
10
|
NodePyATVDeviceEvent,
|
|
9
11
|
NodePyATVDeviceState,
|
|
10
|
-
NodePyATVRepeatState,
|
|
11
|
-
NodePyATVShuffleState,
|
|
12
12
|
NodePyATVKeys,
|
|
13
13
|
NodePyATVListenerState,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
NodePyATVMediaType,
|
|
15
|
+
NodePyATVPowerState,
|
|
16
|
+
NodePyATVProtocol,
|
|
17
|
+
NodePyATVRepeatState,
|
|
18
|
+
NodePyATVShuffleState
|
|
19
|
+
} from '../src/lib/index.js';
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = path.dirname(__filename);
|
|
23
|
+
const version = JSON.parse(readFileSync(__dirname + '/../package.json', 'utf8'))?.version || null;
|
|
16
24
|
|
|
17
25
|
describe('NodePyATVInstance', function () {
|
|
18
26
|
describe('static version()', function () {
|
|
@@ -25,9 +33,7 @@ describe('NodePyATVInstance', function () {
|
|
|
25
33
|
|
|
26
34
|
assert.equal(typeof result.pyatv, 'string', 'result.pyatv is a string');
|
|
27
35
|
assert.ok(result.pyatv.length >= 5, 'result.pyatv has content');
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
-
assert.strictEqual(result.module, require(__dirname + '/../package.json').version || null);
|
|
36
|
+
assert.strictEqual(result.module, version);
|
|
31
37
|
});
|
|
32
38
|
it('should return the pyatv version', async function () {
|
|
33
39
|
const result = await NodePyATVInstance.version({
|
|
@@ -48,8 +54,7 @@ describe('NodePyATVInstance', function () {
|
|
|
48
54
|
)
|
|
49
55
|
});
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
assert.strictEqual(result.module, require(__dirname + '/../package.json').version || null);
|
|
57
|
+
assert.strictEqual(result.module, version);
|
|
53
58
|
});
|
|
54
59
|
it('should handle option.atvremotePath', async function () {
|
|
55
60
|
await NodePyATVInstance.version({
|
|
@@ -70,7 +75,9 @@ describe('NodePyATVInstance', function () {
|
|
|
70
75
|
});
|
|
71
76
|
it('should work with option.noColors', async function () {
|
|
72
77
|
await NodePyATVInstance.version({
|
|
73
|
-
debug: () => {
|
|
78
|
+
debug: () => {
|
|
79
|
+
// no debug log
|
|
80
|
+
},
|
|
74
81
|
noColors: true,
|
|
75
82
|
spawn: createFakeSpawn(cp =>
|
|
76
83
|
cp.code(1).end()
|
|
@@ -104,7 +111,7 @@ describe('NodePyATVInstance', function () {
|
|
|
104
111
|
|
|
105
112
|
assert.strictEqual(result.pyatv, null);
|
|
106
113
|
});
|
|
107
|
-
it('should return null on empty module version', async function () {
|
|
114
|
+
/* it('should return null on empty module version', async function () {
|
|
108
115
|
const path = require.resolve(__dirname + '/../package.json');
|
|
109
116
|
require(path);
|
|
110
117
|
|
|
@@ -119,8 +126,8 @@ describe('NodePyATVInstance', function () {
|
|
|
119
126
|
});
|
|
120
127
|
|
|
121
128
|
assert.strictEqual(result.module, null);
|
|
122
|
-
});
|
|
123
|
-
it('should return null on invalid module version', async function () {
|
|
129
|
+
}); */
|
|
130
|
+
/* it('should return null on invalid module version', async function () {
|
|
124
131
|
const path = require.resolve(__dirname + '/../package.json');
|
|
125
132
|
require(path);
|
|
126
133
|
|
|
@@ -135,7 +142,7 @@ describe('NodePyATVInstance', function () {
|
|
|
135
142
|
});
|
|
136
143
|
|
|
137
144
|
assert.strictEqual(result.module, null);
|
|
138
|
-
});
|
|
145
|
+
}); */
|
|
139
146
|
});
|
|
140
147
|
|
|
141
148
|
describe('static check()', function () {
|
|
@@ -143,7 +150,7 @@ describe('NodePyATVInstance', function () {
|
|
|
143
150
|
this.timeout(12000);
|
|
144
151
|
await NodePyATVInstance.check();
|
|
145
152
|
});
|
|
146
|
-
it('should return nice error message if pyatv was not found', async function() {
|
|
153
|
+
it('should return nice error message if pyatv was not found', async function () {
|
|
147
154
|
await assert.rejects(async () => {
|
|
148
155
|
await NodePyATVInstance.check({
|
|
149
156
|
spawn: createFakeSpawn(cp => {
|
|
@@ -161,12 +168,12 @@ describe('NodePyATVInstance', function () {
|
|
|
161
168
|
});
|
|
162
169
|
}, /Found pyatv, but unforunately it's too old. Please update pyatv./);
|
|
163
170
|
});
|
|
164
|
-
it('should return nice error message if scan failed', async function() {
|
|
171
|
+
it('should return nice error message if scan failed', async function () {
|
|
165
172
|
let i = 0;
|
|
166
173
|
await assert.rejects(async () => {
|
|
167
174
|
await NodePyATVInstance.check({
|
|
168
175
|
spawn: createFakeSpawn(cp => {
|
|
169
|
-
if(i === 0) {
|
|
176
|
+
if (i === 0) {
|
|
170
177
|
cp.stdout('atvremote 0.7.0').code(1).end();
|
|
171
178
|
i++;
|
|
172
179
|
} else {
|
|
@@ -250,19 +257,98 @@ describe('NodePyATVInstance', function () {
|
|
|
250
257
|
});
|
|
251
258
|
}, /Unable to parse pyatv response: /);
|
|
252
259
|
});
|
|
260
|
+
it('should work if devices are without device_info / services', async function () {
|
|
261
|
+
const devices = await NodePyATVInstance.find({
|
|
262
|
+
spawn: createFakeSpawn(cp => {
|
|
263
|
+
cp.stdout({
|
|
264
|
+
result: 'success',
|
|
265
|
+
datetime: '2020-11-06T20:47:30.840022+01:00',
|
|
266
|
+
devices: [
|
|
267
|
+
{
|
|
268
|
+
name: 'Vardagsrum',
|
|
269
|
+
address: '10.0.10.81',
|
|
270
|
+
identifier: 'xxx'
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}).code(1).end();
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
assert.strictEqual(devices.length, 1);
|
|
278
|
+
assert.strictEqual(devices[0].name, 'Vardagsrum');
|
|
279
|
+
assert.strictEqual(devices[0].host, '10.0.10.81');
|
|
280
|
+
assert.strictEqual(devices[0].id, 'xxx');
|
|
281
|
+
assert.strictEqual(devices[0].model, undefined);
|
|
282
|
+
assert.strictEqual(devices[0].modelName, undefined);
|
|
283
|
+
assert.strictEqual(devices[0].os, undefined);
|
|
284
|
+
assert.strictEqual(devices[0].version, undefined);
|
|
285
|
+
assert.deepStrictEqual(devices[0].services, undefined);
|
|
286
|
+
});
|
|
287
|
+
it('should work if devices are with device_info / services', async function () {
|
|
288
|
+
const devices = await NodePyATVInstance.find({
|
|
289
|
+
spawn: createFakeSpawn(cp => {
|
|
290
|
+
cp.stdout({
|
|
291
|
+
result: 'success',
|
|
292
|
+
datetime: '2020-11-06T20:47:30.840022+01:00',
|
|
293
|
+
devices: [
|
|
294
|
+
{
|
|
295
|
+
name: 'Vardagsrum',
|
|
296
|
+
address: '10.0.10.81',
|
|
297
|
+
identifier: 'xxx',
|
|
298
|
+
device_info: {
|
|
299
|
+
'model': 'Gen4K',
|
|
300
|
+
'model_str': 'Apple TV 4K',
|
|
301
|
+
'operating_system': 'TvOS',
|
|
302
|
+
'version': '15.5.1'
|
|
303
|
+
},
|
|
304
|
+
services: [
|
|
305
|
+
{
|
|
306
|
+
protocol: 'mrp',
|
|
307
|
+
port: 49152
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
protocol: 'airplay',
|
|
311
|
+
port: 7000
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}).code(1).end();
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
assert.strictEqual(devices.length, 1);
|
|
321
|
+
assert.strictEqual(devices[0].name, 'Vardagsrum');
|
|
322
|
+
assert.strictEqual(devices[0].host, '10.0.10.81');
|
|
323
|
+
assert.strictEqual(devices[0].id, 'xxx');
|
|
324
|
+
assert.strictEqual(devices[0].model, 'Gen4K');
|
|
325
|
+
assert.strictEqual(devices[0].modelName, 'Apple TV 4K');
|
|
326
|
+
assert.strictEqual(devices[0].os, 'TvOS');
|
|
327
|
+
assert.strictEqual(devices[0].version, '15.5.1');
|
|
328
|
+
assert.deepStrictEqual(devices[0].services, [
|
|
329
|
+
{
|
|
330
|
+
protocol: NodePyATVProtocol.mrp,
|
|
331
|
+
port: 49152
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
protocol: NodePyATVProtocol.airplay,
|
|
335
|
+
port: 7000
|
|
336
|
+
}
|
|
337
|
+
]);
|
|
338
|
+
});
|
|
253
339
|
});
|
|
254
340
|
|
|
255
341
|
describe('static device()', function () {
|
|
256
342
|
it('should pass options to constructor', function () {
|
|
257
|
-
const device = NodePyATVInstance.device({host: '192.168.178.6', name: 'My Testdevice'});
|
|
343
|
+
const device = NodePyATVInstance.device({ host: '192.168.178.6', name: 'My Testdevice' });
|
|
258
344
|
assert.strictEqual(device.host, '192.168.178.6');
|
|
259
345
|
assert.strictEqual(device.name, 'My Testdevice');
|
|
260
346
|
});
|
|
261
347
|
});
|
|
262
348
|
|
|
263
|
-
describe('version()', function() {
|
|
264
|
-
it('should merge options from constructor', async function() {
|
|
265
|
-
const i = new NodePyATVInstance({atvremotePath: 'test'});
|
|
349
|
+
describe('version()', function () {
|
|
350
|
+
it('should merge options from constructor', async function () {
|
|
351
|
+
const i = new NodePyATVInstance({ atvremotePath: 'test' });
|
|
266
352
|
await i.version({
|
|
267
353
|
spawn: createFakeSpawn(cp => {
|
|
268
354
|
assert.strictEqual(cp.cmd(), 'test');
|
|
@@ -272,9 +358,9 @@ describe('NodePyATVInstance', function () {
|
|
|
272
358
|
});
|
|
273
359
|
});
|
|
274
360
|
|
|
275
|
-
describe('check()', function() {
|
|
276
|
-
it('should merge options from constructor', async function() {
|
|
277
|
-
const i = new NodePyATVInstance({atvremotePath: 'test'});
|
|
361
|
+
describe('check()', function () {
|
|
362
|
+
it('should merge options from constructor', async function () {
|
|
363
|
+
const i = new NodePyATVInstance({ atvremotePath: 'test' });
|
|
278
364
|
await assert.rejects(async () => {
|
|
279
365
|
await i.check({
|
|
280
366
|
spawn: createFakeSpawn(cp => {
|
|
@@ -286,9 +372,9 @@ describe('NodePyATVInstance', function () {
|
|
|
286
372
|
});
|
|
287
373
|
});
|
|
288
374
|
|
|
289
|
-
describe('find()', function() {
|
|
290
|
-
it('should merge options from constructor', async function() {
|
|
291
|
-
const i = new NodePyATVInstance({atvscriptPath: 'test'});
|
|
375
|
+
describe('find()', function () {
|
|
376
|
+
it('should merge options from constructor', async function () {
|
|
377
|
+
const i = new NodePyATVInstance({ atvscriptPath: 'test' });
|
|
292
378
|
await i.find({
|
|
293
379
|
spawn: createFakeSpawn(cp => {
|
|
294
380
|
assert.strictEqual(cp.cmd(), 'test');
|
|
@@ -303,39 +389,39 @@ describe('NodePyATVInstance', function () {
|
|
|
303
389
|
});
|
|
304
390
|
|
|
305
391
|
describe('device()', function () {
|
|
306
|
-
it('should merge options from constructor', async function() {
|
|
307
|
-
const i = new NodePyATVInstance({debug: true});
|
|
308
|
-
const d = i.device({name: 'My Testdevice', host: '192.168.178.2'});
|
|
392
|
+
it('should merge options from constructor', async function () {
|
|
393
|
+
const i = new NodePyATVInstance({ debug: true });
|
|
394
|
+
const d = i.device({ name: 'My Testdevice', host: '192.168.178.2' });
|
|
309
395
|
assert.deepStrictEqual(d.debug, true);
|
|
310
396
|
});
|
|
311
397
|
});
|
|
312
398
|
|
|
313
399
|
describe('Type Exports', function () {
|
|
314
|
-
it('Type NodePyATVProtocol should be exported', function() {
|
|
400
|
+
it('Type NodePyATVProtocol should be exported', function () {
|
|
315
401
|
assert.ok(NodePyATVProtocol);
|
|
316
402
|
});
|
|
317
|
-
it('Type NodePyATVMediaType should be exported', function() {
|
|
403
|
+
it('Type NodePyATVMediaType should be exported', function () {
|
|
318
404
|
assert.ok(NodePyATVMediaType);
|
|
319
405
|
});
|
|
320
|
-
it('Type NodePyATVDeviceEvent should be exported', function() {
|
|
406
|
+
it('Type NodePyATVDeviceEvent should be exported', function () {
|
|
321
407
|
assert.ok(NodePyATVDeviceEvent);
|
|
322
408
|
});
|
|
323
|
-
it('Type NodePyATVDeviceState should be exported', function() {
|
|
409
|
+
it('Type NodePyATVDeviceState should be exported', function () {
|
|
324
410
|
assert.ok(NodePyATVDeviceState);
|
|
325
411
|
});
|
|
326
|
-
it('Type NodePyATVRepeatState should be exported', function() {
|
|
412
|
+
it('Type NodePyATVRepeatState should be exported', function () {
|
|
327
413
|
assert.ok(NodePyATVRepeatState);
|
|
328
414
|
});
|
|
329
|
-
it('Type NodePyATVShuffleState should be exported', function() {
|
|
415
|
+
it('Type NodePyATVShuffleState should be exported', function () {
|
|
330
416
|
assert.ok(NodePyATVShuffleState);
|
|
331
417
|
});
|
|
332
|
-
it('Type NodePyATVKeys should be exported', function() {
|
|
418
|
+
it('Type NodePyATVKeys should be exported', function () {
|
|
333
419
|
assert.ok(NodePyATVKeys);
|
|
334
420
|
});
|
|
335
|
-
it('Type NodePyATVInstanceOptions should be exported', function() {
|
|
421
|
+
it('Type NodePyATVInstanceOptions should be exported', function () {
|
|
336
422
|
assert.ok(NodePyATVListenerState);
|
|
337
423
|
});
|
|
338
|
-
it('Type NodePyATVPowerState should be exported', function() {
|
|
424
|
+
it('Type NodePyATVPowerState should be exported', function () {
|
|
339
425
|
assert.ok(NodePyATVPowerState);
|
|
340
426
|
});
|
|
341
427
|
});
|
package/test/tools.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import assert from 'assert';
|
|
4
|
-
import { addRequestId, debug, getExecutable, getParamters, parseState, removeRequestId } from '../src/lib/tools';
|
|
4
|
+
import { addRequestId, debug, getExecutable, getParamters, parseState, removeRequestId } from '../src/lib/tools.js';
|
|
5
5
|
import {
|
|
6
6
|
NodePyATVDeviceState,
|
|
7
7
|
NodePyATVExecutableType,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
NodePyATVProtocol,
|
|
10
10
|
NodePyATVRepeatState,
|
|
11
11
|
NodePyATVShuffleState
|
|
12
|
-
} from '../src/lib/types';
|
|
12
|
+
} from '../src/lib/types.js';
|
|
13
13
|
|
|
14
14
|
describe('Tools', function () {
|
|
15
15
|
describe('addRequestId() / removeRequestId()', function () {
|