fix tests

This commit is contained in:
Ildar Kamalov
2026-07-23 16:58:47 +03:00
parent 40cc9ccf42
commit 8371be2f08
3 changed files with 13 additions and 3 deletions
@@ -9,7 +9,8 @@ vi.mock('panel/api/generated', () => ({
}));
vi.mock('panel/stores/toasts', () => ({ addErrorToast: vi.fn() }));
vi.mock('panel/helpers/constants', () => ({
vi.mock('panel/helpers/constants', async (importOriginal) => ({
...(await importOriginal<typeof import('panel/helpers/constants')>()),
ALL_INTERFACES_IP: '0.0.0.0',
INSTALL_FIRST_STEP: 1,
STANDARD_DNS_PORT: 53,
+7
View File
@@ -1,6 +1,13 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { translate } from '@adguard/translate';
import { LocalStorageHelper } from '../helpers/localStorageHelper';
// Ensure the real constants module is available even when other test files
// (e.g., install-store.test.ts) mock it with a partial stub.
vi.mock('panel/helpers/constants', async (importOriginal) =>
importOriginal<typeof import('panel/helpers/constants')>(),
);
import {
createSolidDefaultValues,
solidMessageConstructor,
+4 -2
View File
@@ -11,8 +11,10 @@ vi.mock('panel/stores/toasts', () => ({
addErrorToast: vi.fn(),
}));
// Mock HTML_PAGES constant.
vi.mock('panel/helpers/constants', () => ({
// Mock HTML_PAGES constant, but pass through all real exports so
// transitive dependencies (e.g., LANGUAGE_QUERY_PARAM in intl) work.
vi.mock('panel/helpers/constants', async (importOriginal) => ({
...(await importOriginal<typeof import('panel/helpers/constants')>()),
HTML_PAGES: { LOGIN: '/login.html', MAIN: '/dashboard.html' },
}));