@xiboplayer/xmr 0.6.1 → 0.6.2
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/package.json +2 -2
- package/src/xmr-wrapper.test.js +19 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/xmr",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "XMR WebSocket client for real-time Xibo CMS commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xibosignage/xibo-communication-framework": "^0.0.6",
|
|
13
|
-
"@xiboplayer/utils": "0.6.
|
|
13
|
+
"@xiboplayer/utils": "0.6.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"vitest": "^2.0.0"
|
package/src/xmr-wrapper.test.js
CHANGED
|
@@ -9,6 +9,10 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
|
9
9
|
import { XmrWrapper } from './xmr-wrapper.js';
|
|
10
10
|
import { createSpy, createMockPlayer, createMockConfig, wait } from './test-utils.js';
|
|
11
11
|
|
|
12
|
+
// Matches "HH:MM:SS.mmm [Name]" timestamp prefix
|
|
13
|
+
const ts = (name, suffix = '') =>
|
|
14
|
+
expect.stringMatching(new RegExp(`^\\d{2}:\\d{2}:\\d{2}\\.\\d{3} \\[${name}\\]${suffix}$`));
|
|
15
|
+
|
|
12
16
|
// Mock the official Xmr class
|
|
13
17
|
vi.mock('@xibosignage/xibo-communication-framework', () => {
|
|
14
18
|
class MockXmr {
|
|
@@ -240,7 +244,7 @@ describe('XmrWrapper', () => {
|
|
|
240
244
|
|
|
241
245
|
// Logger outputs as separate args: '[XMR]', 'collectNow failed:', Error
|
|
242
246
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
243
|
-
'
|
|
247
|
+
ts('XMR'),
|
|
244
248
|
'collectNow failed:',
|
|
245
249
|
expect.any(Error)
|
|
246
250
|
);
|
|
@@ -269,7 +273,7 @@ describe('XmrWrapper', () => {
|
|
|
269
273
|
await vi.runAllTimersAsync();
|
|
270
274
|
|
|
271
275
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
272
|
-
'
|
|
276
|
+
ts('XMR'),
|
|
273
277
|
'screenShot failed:',
|
|
274
278
|
expect.any(Error)
|
|
275
279
|
);
|
|
@@ -298,7 +302,7 @@ describe('XmrWrapper', () => {
|
|
|
298
302
|
await vi.runAllTimersAsync();
|
|
299
303
|
|
|
300
304
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
301
|
-
'
|
|
305
|
+
ts('XMR'),
|
|
302
306
|
'changeLayout failed:',
|
|
303
307
|
expect.any(Error)
|
|
304
308
|
);
|
|
@@ -330,7 +334,7 @@ describe('XmrWrapper', () => {
|
|
|
330
334
|
await vi.runAllTimersAsync();
|
|
331
335
|
|
|
332
336
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
333
|
-
'
|
|
337
|
+
ts('XMR'),
|
|
334
338
|
'Key rotation failed:',
|
|
335
339
|
expect.any(Error)
|
|
336
340
|
);
|
|
@@ -355,7 +359,7 @@ describe('XmrWrapper', () => {
|
|
|
355
359
|
await vi.runAllTimersAsync();
|
|
356
360
|
|
|
357
361
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
358
|
-
'
|
|
362
|
+
ts('XMR'),
|
|
359
363
|
'criteriaUpdate failed:',
|
|
360
364
|
expect.any(Error)
|
|
361
365
|
);
|
|
@@ -396,7 +400,7 @@ describe('XmrWrapper', () => {
|
|
|
396
400
|
await vi.runAllTimersAsync();
|
|
397
401
|
|
|
398
402
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
399
|
-
'
|
|
403
|
+
ts('XMR'),
|
|
400
404
|
'Geo location reporting not implemented in player'
|
|
401
405
|
);
|
|
402
406
|
consoleWarnSpy.mockRestore();
|
|
@@ -410,7 +414,7 @@ describe('XmrWrapper', () => {
|
|
|
410
414
|
await vi.runAllTimersAsync();
|
|
411
415
|
|
|
412
416
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
413
|
-
'
|
|
417
|
+
ts('XMR'),
|
|
414
418
|
'Geo location request not implemented in player'
|
|
415
419
|
);
|
|
416
420
|
consoleWarnSpy.mockRestore();
|
|
@@ -424,7 +428,7 @@ describe('XmrWrapper', () => {
|
|
|
424
428
|
await vi.runAllTimersAsync();
|
|
425
429
|
|
|
426
430
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
427
|
-
'
|
|
431
|
+
ts('XMR'),
|
|
428
432
|
'currentGeoLocation failed:',
|
|
429
433
|
expect.any(Error)
|
|
430
434
|
);
|
|
@@ -446,7 +450,7 @@ describe('XmrWrapper', () => {
|
|
|
446
450
|
await vi.runAllTimersAsync();
|
|
447
451
|
|
|
448
452
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
449
|
-
'
|
|
453
|
+
ts('XMR'),
|
|
450
454
|
'overlayLayout failed:',
|
|
451
455
|
expect.any(Error)
|
|
452
456
|
);
|
|
@@ -468,7 +472,7 @@ describe('XmrWrapper', () => {
|
|
|
468
472
|
await vi.runAllTimersAsync();
|
|
469
473
|
|
|
470
474
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
471
|
-
'
|
|
475
|
+
ts('XMR'),
|
|
472
476
|
'revertToSchedule failed:',
|
|
473
477
|
expect.any(Error)
|
|
474
478
|
);
|
|
@@ -490,7 +494,7 @@ describe('XmrWrapper', () => {
|
|
|
490
494
|
await vi.runAllTimersAsync();
|
|
491
495
|
|
|
492
496
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
493
|
-
'
|
|
497
|
+
ts('XMR'),
|
|
494
498
|
'purgeAll failed:',
|
|
495
499
|
expect.any(Error)
|
|
496
500
|
);
|
|
@@ -521,7 +525,7 @@ describe('XmrWrapper', () => {
|
|
|
521
525
|
await vi.runAllTimersAsync();
|
|
522
526
|
|
|
523
527
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
524
|
-
'
|
|
528
|
+
ts('XMR'),
|
|
525
529
|
'commandAction failed:',
|
|
526
530
|
expect.any(Error)
|
|
527
531
|
);
|
|
@@ -554,7 +558,7 @@ describe('XmrWrapper', () => {
|
|
|
554
558
|
await vi.runAllTimersAsync();
|
|
555
559
|
|
|
556
560
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
557
|
-
'
|
|
561
|
+
ts('XMR'),
|
|
558
562
|
'triggerWebhook failed:',
|
|
559
563
|
expect.any(Error)
|
|
560
564
|
);
|
|
@@ -578,7 +582,7 @@ describe('XmrWrapper', () => {
|
|
|
578
582
|
await vi.runAllTimersAsync();
|
|
579
583
|
|
|
580
584
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
581
|
-
'
|
|
585
|
+
ts('XMR'),
|
|
582
586
|
'dataUpdate failed:',
|
|
583
587
|
expect.any(Error)
|
|
584
588
|
);
|
|
@@ -664,7 +668,7 @@ describe('XmrWrapper', () => {
|
|
|
664
668
|
await wrapper.stop();
|
|
665
669
|
|
|
666
670
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
667
|
-
'
|
|
671
|
+
ts('XMR'),
|
|
668
672
|
'Error stopping:',
|
|
669
673
|
expect.any(Error)
|
|
670
674
|
);
|