test: Remove unnecessary jsdom environment declarations (#2616)
This commit is contained in:
@@ -80,7 +80,6 @@ const fireMessage = (hass: HomeAssistant, data: unknown, n = 0): void => {
|
||||
mock.calls[n][0](data);
|
||||
};
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('FrigateEventWatcher', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
@@ -226,7 +225,6 @@ describe('FrigateEventWatcher', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('FrigateReviewWatcher', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @vitest-environment jsdom
|
||||
import { endOfDay, startOfDay } from 'date-fns';
|
||||
import { afterEach, assert, describe, expect, it, vi } from 'vitest';
|
||||
import { mock, type MockProxy } from 'vitest-mock-extended';
|
||||
|
||||
@@ -53,7 +53,6 @@ import { GENERATED_ACTION } from '../../../src/config/schema/actions/custom/gene
|
||||
import { INTERNAL_CALLBACK_ACTION } from '../../../src/config/schema/actions/custom/internal';
|
||||
import type { ActionConfig } from '../../../src/config/schema/actions/types';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('ActionFactory', () => {
|
||||
it('should return null for mismatched card-id', () => {
|
||||
const factory = new ActionFactory();
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import { createCardAPI, createConfig, createHASS } from '../test-utils';
|
||||
vi.mock('../../src/localize/localize.js');
|
||||
vi.mock('../../src/ha/side-load-ha-elements.js');
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('InitializationManager', () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetAllMocks();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { createRetryControl } from '../../../src/card-controller/issues/retry-control';
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it, vi } from 'vitest';
|
||||
import { SignalingChannel } from '../../../../../src/components-lib/live/providers/go2rtc-experimental/signaling';
|
||||
import { FakeWebSocket } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('SignalingChannel', () => {
|
||||
const setup = (options?: {
|
||||
openCallback?: () => void;
|
||||
|
||||
@@ -85,7 +85,6 @@ const calculateButtons = (
|
||||
);
|
||||
};
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('MenuButtonController', () => {
|
||||
let controller: MenuButtonController;
|
||||
const dynamicButton: MenuItem = {
|
||||
|
||||
@@ -57,7 +57,6 @@ describe('generateViewContextForZoom', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('handleZoomSettingsObservedEvent', () => {
|
||||
it('should reject observed zoom settings without viewManager ', () => {
|
||||
handleZoomSettingsObservedEvent(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('and condition', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createConditionEvaluator } from '../../../../src/condition-trigger/cond
|
||||
import { callConditionSchema } from '../../../../src/config/schema/condition-trigger/conditions/custom/call';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('call condition', () => {
|
||||
it('should require a value', () => {
|
||||
expect(() => callConditionSchema.parse({ condition: 'call' })).toThrow();
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('camera condition', () => {
|
||||
it('should match a named camera', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('display mode condition', () => {
|
||||
it('should match a display mode condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createConditionEvaluator } from '../../../../src/condition-trigger/cond
|
||||
import { expandConditionSchema } from '../../../../src/config/schema/condition-trigger/conditions/custom/expand';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('expand condition', () => {
|
||||
it('should match an expand condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createConditionEvaluator } from '../../../../src/condition-trigger/cond
|
||||
import { fullscreenConditionSchema } from '../../../../src/config/schema/condition-trigger/conditions/custom/fullscreen';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('fullscreen condition', () => {
|
||||
it('should match a fullscreen condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('initialized condition', () => {
|
||||
it('should match an initialized condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createConditionEvaluator } from '../../../../src/condition-trigger/cond
|
||||
import { interactionConditionSchema } from '../../../../src/config/schema/condition-trigger/conditions/custom/interaction';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('interaction condition', () => {
|
||||
it('should match an interaction condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('key condition', () => {
|
||||
it('should match a simple keypress', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -5,7 +5,6 @@ import { mediaLoadedConditionSchema } from '../../../../src/config/schema/condit
|
||||
import { createMediaLoadedInfo } from '../../../test-utils';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('media loaded condition', () => {
|
||||
it('should match a media loaded condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { MicrophoneState } from '../../../../src/card-controller/types';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('microphone condition', () => {
|
||||
const createMicrophoneState = (state: Partial<MicrophoneState>): MicrophoneState => {
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('not condition', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
|
||||
@@ -3,7 +3,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('or condition', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('triggered condition', () => {
|
||||
it('should match any triggered camera when no list is given', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('user agent condition', () => {
|
||||
const userAgent =
|
||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36';
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createConditionEvaluator } from '../../../../src/condition-trigger/cond
|
||||
import { createHASS, createUser } from '../../../test-utils';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('user condition', () => {
|
||||
it('should match a user condition', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
||||
import { createConditionEvaluator } from '../../../../src/condition-trigger/conditions/factory';
|
||||
import { createEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('view condition', () => {
|
||||
it('should match a named view', () => {
|
||||
const evaluator = createConditionEvaluator(
|
||||
|
||||
@@ -29,7 +29,6 @@ import { createHASSManager, createMockTemplateRenderer } from '../../test-utils'
|
||||
|
||||
type TriggerEvaluatorConstructor = new (...args: never[]) => TriggerEvaluator;
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('createTriggerEvaluator', () => {
|
||||
const context = (): TriggerEvaluatorContext => ({
|
||||
stateManager: new ConditionStateManager(),
|
||||
|
||||
@@ -5,7 +5,6 @@ import { CallTrigger } from '../../../../src/condition-trigger/triggers/triggers
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('CallTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'call'>,
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/t
|
||||
import { createConfig } from '../../../test-utils';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('CameraTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'camera'>,
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/t
|
||||
import { createConfig } from '../../../test-utils';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('ConfigTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'config'>,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { DisplayModeTrigger } from '../../../../src/condition-trigger/triggers/t
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('DisplayModeTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'display_mode'>,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ExpandTrigger } from '../../../../src/condition-trigger/triggers/trigge
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('ExpandTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'expand'>,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { FullscreenTrigger } from '../../../../src/condition-trigger/triggers/tr
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('FullscreenTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'fullscreen'>,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { InteractionTrigger } from '../../../../src/condition-trigger/triggers/t
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('InteractionTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'interaction'>,
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/t
|
||||
import { createMediaLoadedInfo } from '../../../test-utils';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('MediaLoadedTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'media_loaded'>,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { MicrophoneTrigger } from '../../../../src/condition-trigger/triggers/tr
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('MicrophoneTrigger', () => {
|
||||
const createMicrophoneState = (state: Partial<MicrophoneState>): MicrophoneState => ({
|
||||
connected: false,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { TriggeredTrigger } from '../../../../src/condition-trigger/triggers/tri
|
||||
import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/triggers/types';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('TriggeredTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'triggered'>,
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { TriggerOfType } from '../../../../src/condition-trigger/triggers/t
|
||||
import { ViewTrigger } from '../../../../src/condition-trigger/triggers/triggers/view';
|
||||
import { createTriggerEvaluatorContext } from './test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('ViewTrigger', () => {
|
||||
const create = (
|
||||
trigger: TriggerOfType<'view'>,
|
||||
|
||||
@@ -13,7 +13,6 @@ import { customSchema } from '../../src/config/schema/elements/stock/custom';
|
||||
import { conditionalSchema } from '../../src/config/schema/elements/types';
|
||||
import { createConfig } from '../test-utils';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('config defaults', () => {
|
||||
it('should be as expected', () => {
|
||||
expect(createConfig()).toEqual({
|
||||
|
||||
@@ -596,7 +596,6 @@ describe('getActionName', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('stopEventFromActivatingCardWideActions', () => {
|
||||
it('should stop event from propogating', () => {
|
||||
const event = mock<Event>();
|
||||
|
||||
@@ -26,7 +26,6 @@ describe('getReleaseVersion', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('getDiagnostics', () => {
|
||||
const now = new Date('2023-10-01T21:53Z');
|
||||
const hass = createHASS();
|
||||
|
||||
Reference in New Issue
Block a user