Bump prettier to v3 and format all files

This commit is contained in:
Felipe Santos
2024-06-10 00:29:50 -03:00
parent 2a637d92b9
commit fccb4c9afd
138 changed files with 6445 additions and 1678 deletions
+1 -1
View File
@@ -1125,7 +1125,7 @@ describe('CameraManager', async () => {
const action = {
action: 'call-service' as const,
service: 'service',
}
};
const manager = createCameraManager(api, engine, [
{
config: createCameraConfig({
+1 -1
View File
@@ -43,7 +43,7 @@ describe('getConfiguredPTZAction', () => {
createCameraConfig({
ptz: {
presets: {
window: action
window: action,
},
},
}),
@@ -145,7 +145,7 @@ describe('ActionsManager', () => {
createConfig({
view: {
actions: {
tap_action: createLogAction("Hello, world!"),
tap_action: createLogAction('Hello, world!'),
},
},
}),
@@ -174,7 +174,7 @@ describe('ActionsManager', () => {
createConfig({
view: {
actions: {
tap_action: createLogAction("Hello, world!"),
tap_action: createLogAction('Hello, world!'),
},
},
}),
@@ -202,7 +202,7 @@ describe('ActionsManager', () => {
});
it('should handle event', () => {
const action = createLogAction("Hello, world!");
const action = createLogAction('Hello, world!');
const event = new CustomEvent('ll-custom', {
detail: action,
});
@@ -232,7 +232,7 @@ describe('ActionsManager', () => {
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
await manager.handleActionExecutionRequestEvent(
new CustomEvent('frigate-card:action:execution-request', {
detail: { action: createLogAction("Hello, world!") },
detail: { action: createLogAction('Hello, world!') },
}),
);
expect(consoleSpy).toBeCalled();
@@ -245,7 +245,7 @@ describe('ActionsManager', () => {
const manager = new ActionsManager(api);
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
await manager.executeActions(createLogAction("Hello, world!"));
await manager.executeActions(createLogAction('Hello, world!'));
expect(consoleSpy).toBeCalled();
});
});
@@ -271,7 +271,7 @@ describe('ActionsManager', () => {
m: 1,
},
})!,
createLogAction("Hello, world!"),
createLogAction('Hello, world!'),
]);
// Stop inflight actions.
@@ -1,13 +1,16 @@
import { expect, it } from "vitest";
import { DefaultAction } from "../../../../src/card-controller/actions/actions/default";
import { createCardAPI } from "../../../test-utils";
import { expect, it } from 'vitest';
import { DefaultAction } from '../../../../src/card-controller/actions/actions/default';
import { createCardAPI } from '../../../test-utils';
it('should handle default action', async () => {
const api = createCardAPI();
const action = new DefaultAction({}, {
action: 'fire-dom-event',
frigate_card_action: 'default',
});
const action = new DefaultAction(
{},
{
action: 'fire-dom-event',
frigate_card_action: 'default',
},
);
await action.execute(api);
@@ -1,14 +1,17 @@
import { expect, it } from "vitest";
import { DisplayModeSelectAction } from "../../../../src/card-controller/actions/actions/display-mode-select";
import { createCardAPI } from "../../../test-utils";
import { expect, it } from 'vitest';
import { DisplayModeSelectAction } from '../../../../src/card-controller/actions/actions/display-mode-select';
import { createCardAPI } from '../../../test-utils';
it('should handle default action', async () => {
const api = createCardAPI();
const action = new DisplayModeSelectAction({}, {
action: 'fire-dom-event',
frigate_card_action: 'display_mode_select',
display_mode: 'grid',
});
const action = new DisplayModeSelectAction(
{},
{
action: 'fire-dom-event',
frigate_card_action: 'display_mode_select',
display_mode: 'grid',
},
);
await action.execute(api);
@@ -430,15 +430,12 @@ describe('should handle ptz action', () => {
);
const context = {};
const startAction = new PTZAction(
context,
{
action: 'fire-dom-event',
frigate_card_action: 'ptz',
ptz_action: 'left',
ptz_phase: 'start',
},
);
const startAction = new PTZAction(context, {
action: 'fire-dom-event',
frigate_card_action: 'ptz',
ptz_action: 'left',
ptz_phase: 'start',
});
await startAction.execute(api);
expect(api.getCameraManager().executePTZAction).toBeCalledWith(
@@ -450,25 +447,22 @@ describe('should handle ptz action', () => {
);
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(1);
await vi.runOnlyPendingTimersAsync()
await vi.runOnlyPendingTimersAsync();
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(2);
await vi.runOnlyPendingTimersAsync()
await vi.runOnlyPendingTimersAsync();
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(3);
const stopAction = new PTZAction(
context,
{
action: 'fire-dom-event',
frigate_card_action: 'ptz',
ptz_action: 'left',
ptz_phase: 'stop',
},
);
const stopAction = new PTZAction(context, {
action: 'fire-dom-event',
frigate_card_action: 'ptz',
ptz_action: 'left',
ptz_phase: 'stop',
});
await stopAction.execute(api);
// There should be no additional calls.
await vi.runOnlyPendingTimersAsync()
await vi.runOnlyPendingTimersAsync();
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(3);
});
@@ -500,11 +494,11 @@ describe('should handle ptz action', () => {
await action.execute(api);
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(1);
await vi.runOnlyPendingTimersAsync()
await vi.runOnlyPendingTimersAsync();
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(2);
action.stop();
await vi.runOnlyPendingTimersAsync()
await vi.runOnlyPendingTimersAsync();
// There should be no additional calls.
expect(api.getCameraManager().executePTZAction).toBeCalledTimes(2);
@@ -18,7 +18,7 @@ it('should handle sleep action', async () => {
frigate_card_action: 'sleep',
duration: {
s: 5,
ms: 200
ms: 200,
},
},
);
@@ -1,16 +1,12 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { CameraEndpoint } from '../../src/camera-manager/types';
import { CameraURLManager } from '../../src/card-controller/camera-url-manager';
import {
CardCameraURLAPI
} from '../../src/card-controller/types';
import { CardCameraURLAPI } from '../../src/card-controller/types';
import { createCardAPI, createViewWithMedia } from '../test-utils';
const createAPIWithMedia = (): CardCameraURLAPI => {
const api = createCardAPI();
vi.mocked(api.getViewManager().getView).mockReturnValue(
createViewWithMedia()
)
vi.mocked(api.getViewManager().getView).mockReturnValue(createViewWithMedia());
return api;
};
@@ -53,11 +53,9 @@ describe('FullscreenManager', () => {
it('should toggle fullscreen', () => {
const toggle = vi.mocked(screenfull.toggle);
const element = document.createElement('div')
const element = document.createElement('div');
const api = createCardAPI();
vi.mocked(api.getCardElementManager().getElement).mockReturnValue(
element,
);
vi.mocked(api.getCardElementManager().getElement).mockReturnValue(element);
const manager = new FullscreenManager(api);
manager.toggleFullscreen();
-1
View File
@@ -3098,7 +3098,6 @@ describe('should handle version specific upgrades', () => {
);
postUpgradeChecks(config);
});
});
});
});
+3 -7
View File
@@ -81,7 +81,7 @@ export const callResizeHandler = (
height: entry.height,
width: entry.width,
},
} as unknown as ResizeObserverEntry),
}) as unknown as ResizeObserverEntry,
),
observer,
);
@@ -109,10 +109,6 @@ export const createEmblaApiInstance = (options?: {
return emblaApi;
};
export const createTestSlideNodes = (options?: {
n?: number;
}): HTMLElement[] => {
return [...Array(options?.n ?? 10).keys()].map((_) =>
document.createElement('div'),
);
export const createTestSlideNodes = (options?: { n?: number }): HTMLElement[] => {
return [...Array(options?.n ?? 10).keys()].map((_) => document.createElement('div'));
};
+4 -1
View File
@@ -43,7 +43,10 @@ describe('hasSubstream/getStreamCameraID', () => {
camera: 'camera',
context: {
live: {
overrides: new Map([['camera', 'camera2'], ['camera3', 'camera4']]),
overrides: new Map([
['camera', 'camera2'],
['camera3', 'camera4'],
]),
},
},
});
+1 -1
View File
@@ -46,7 +46,7 @@ describe('ViewMedia', () => {
const fakeNow = new Date('2023-08-08T17:15:00');
vi.setSystemTime(fakeNow);
expect(media.getUsableEndTime()).toEqual(fakeNow)
expect(media.getUsableEndTime()).toEqual(fakeNow);
});
});