Some checks failed
CI / test-backend (push) Successful in 4s
CI / build-frontend (push) Successful in 1m49s
CI / test-lang (push) Successful in 1m47s
CI / test-backend (pull_request) Successful in 24s
Build and Publish Docker Image / build (pull_request) Has been skipped
CI / test-lang (pull_request) Successful in 52s
OSV-Scanner PR Scan / scan-pr (pull_request) Successful in 24s
CI / lint (push) Failing after 5m14s
CI / lint (pull_request) Failing after 5m8s
Tests / test (push) Failing after 9m17s
CI / build-frontend (pull_request) Successful in 9m48s
Benchmarks / benchmark (push) Successful in 14m52s
Benchmarks / benchmark (pull_request) Successful in 15m9s
Build and Publish Docker Image / build-dev (pull_request) Successful in 13m47s
Tests / test (pull_request) Failing after 25m50s
Build Test / Build and Test (pull_request) Successful in 53m37s
Build Test / Build and Test (push) Successful in 56m30s
84 lines
2.3 KiB
JavaScript
84 lines
2.3 KiB
JavaScript
import { vi } from "vitest";
|
|
import { config } from "@vue/test-utils";
|
|
|
|
// Global mocks
|
|
global.performance.mark = vi.fn();
|
|
global.performance.measure = vi.fn();
|
|
global.performance.getEntriesByName = vi.fn(() => []);
|
|
global.performance.clearMarks = vi.fn();
|
|
global.performance.clearMeasures = vi.fn();
|
|
|
|
// Mock window.axios by default to prevent TypeErrors
|
|
global.axios = {
|
|
get: vi.fn().mockResolvedValue({ data: {} }),
|
|
post: vi.fn().mockResolvedValue({ data: {} }),
|
|
put: vi.fn().mockResolvedValue({ data: {} }),
|
|
patch: vi.fn().mockResolvedValue({ data: {} }),
|
|
delete: vi.fn().mockResolvedValue({ data: {} }),
|
|
};
|
|
window.axios = global.axios;
|
|
|
|
// Stub all Vuetify components to avoid warnings and CSS issues
|
|
config.global.stubs = {
|
|
MaterialDesignIcon: { template: '<div class="mdi-stub"><slot /></div>' },
|
|
RouterLink: { template: "<a><slot /></a>" },
|
|
RouterView: { template: "<div><slot /></div>" },
|
|
// Common Vuetify components
|
|
"v-app": true,
|
|
"v-main": true,
|
|
"v-container": true,
|
|
"v-row": true,
|
|
"v-col": true,
|
|
"v-btn": true,
|
|
"v-icon": true,
|
|
"v-card": true,
|
|
"v-card-title": true,
|
|
"v-card-text": true,
|
|
"v-card-actions": true,
|
|
"v-dialog": true,
|
|
"v-text-field": true,
|
|
"v-textarea": true,
|
|
"v-select": true,
|
|
"v-switch": true,
|
|
"v-checkbox": true,
|
|
"v-list": true,
|
|
"v-list-item": true,
|
|
"v-list-item-title": true,
|
|
"v-list-item-subtitle": true,
|
|
"v-menu": true,
|
|
"v-divider": true,
|
|
"v-spacer": true,
|
|
"v-progress-circular": true,
|
|
"v-progress-linear": true,
|
|
"v-tabs": true,
|
|
"v-tab": true,
|
|
"v-window": true,
|
|
"v-window-item": true,
|
|
"v-expansion-panels": true,
|
|
"v-expansion-panel": true,
|
|
"v-expansion-panel-title": true,
|
|
"v-expansion-panel-text": true,
|
|
"v-chip": true,
|
|
"v-toolbar": true,
|
|
"v-toolbar-title": true,
|
|
"v-tooltip": true,
|
|
"v-alert": true,
|
|
"v-snackbar": true,
|
|
"v-badge": true,
|
|
};
|
|
|
|
// Mock window.matchMedia
|
|
Object.defineProperty(window, "matchMedia", {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(), // deprecated
|
|
removeListener: vi.fn(), // deprecated
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|