Skip to content

Commit 97e0d6c

Browse files
committed
Fix tests Events->Event from rename
1 parent 8920587 commit 97e0d6c

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/unit/shared.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { jest } from '@jest/globals';
33
import { JSDOM } from 'jsdom';
44
import { dirname } from 'path';
55
import { fileURLToPath } from 'url';
6-
import { Events, Message, arrFromLengthy, clone, debounce, dot, getCookie, injectFunction, injectScript, isMobile, isVideoListPage, isVideoPage, norm, parseMaybeJSON, parseTypeObject, replyMessage, sendEventHandler, sendMessage } from '../../src/scripts/helpers/shared';
6+
import { Event, Message, arrFromLengthy, clone, debounce, dot, getCookie, injectFunction, injectScript, isMobile, isVideoListPage, isVideoPage, norm, parseMaybeJSON, parseTypeObject, replyMessage, sendEventHandler, sendMessage } from '../../src/scripts/helpers/shared';
77

88
const __dirname = dirname(fileURLToPath(import.meta.url));
99

@@ -17,8 +17,8 @@ describe('dot product operations', () => {
1717
});
1818

1919
test('multi-dimensional', () => {
20-
const a1 = [ 1,2,3 ];
21-
const a2 = [ 3,2,1 ];
20+
const a1 = [ 1, 2, 3 ];
21+
const a2 = [ 3, 2, 1 ];
2222
const d = a1[0] * a2[0] + a1[1] * a2[1] + a1[2] * a2[2];
2323
expect(dot(a1, a2)).toBeCloseTo(d);
2424
});
@@ -63,7 +63,7 @@ describe('array equality', () => {
6363

6464
test('different items', () => {
6565
expect([1].equals([2])).toBe(false);
66-
expect([ 1,2,3 ].equals([ 2,1,3 ])).toBe(false);
66+
expect([ 1, 2, 3 ].equals([ 2, 1, 3 ])).toBe(false);
6767
});
6868

6969
test('same values', () => {
@@ -109,7 +109,7 @@ describe('other', () => {
109109
});
110110

111111
test('clone returns equivalent object', () => {
112-
const obj = { some: 'data', with: { nested: { arrays: [{ }] } } };
112+
const obj = { some: 'data', with: { nested: { arrays: [{}] } } };
113113
expect(clone(obj)).toEqual(obj);
114114
});
115115

@@ -333,10 +333,10 @@ describe('message event listeners', () => {
333333

334334
test('sends a register event', () => new Promise((resolve) => {
335335
mock.mockImplementation((ev) => {
336-
expect(JSON.parse(ev.data).event).toBe(Events.QUEUE_CHANGE);
336+
expect(JSON.parse(ev.data).event).toBe(Event.QUEUE_CHANGE);
337337
resolve(0);
338338
});
339-
sendEventHandler(Events.QUEUE_CHANGE, () => { /* */ }, true);
339+
sendEventHandler(Event.QUEUE_CHANGE, () => { /* */ }, true);
340340
}));
341341

342342
test('runs listeners', async () => {
@@ -348,7 +348,7 @@ describe('message event listeners', () => {
348348
({ name } = JSON.parse(ev.data));
349349
resolve(0);
350350
});
351-
sendEventHandler(Events.QUEUE_CHANGE, cb, true);
351+
sendEventHandler(Event.QUEUE_CHANGE, cb, true);
352352
});
353353
mock.mockRestore(); // we post below, don't make problems
354354

@@ -372,7 +372,7 @@ describe('message reply', () => {
372372
});
373373

374374
const reply = (data: any, origin = '*') => (ev: MessageEvent) => {
375-
const msg = parseTypeObject<{ type: string, name: string }>(ev.data);
375+
const msg = parseTypeObject<{ type: string, name: string; }>(ev.data);
376376
// need to manually define these, because jsdom doesn't implement this behaviour
377377
const e = new MessageEvent('message', { origin, source: window });
378378
replyMessage(e, msg.name, data);

0 commit comments

Comments
 (0)