fix tests
Some checks are pending
build / test (macOS-latest) (push) Waiting to run
build / test (ubuntu-latest) (push) Waiting to run
build / test (windows-latest) (push) Waiting to run
build / build-release (push) Blocked by required conditions
build / notify (push) Blocked by required conditions
lint / go-lint (push) Waiting to run
lint / eslint (push) Waiting to run
lint / notify (push) Blocked by required conditions

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

View file

@ -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,

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,

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' },
}));