PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.0.1
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.0.1
1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
xspeed / tests-js / setup.ts

setup.ts in xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN 1.0.1, at tests-js/setup.ts

27 lines 754 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import '@testing-library/jest-dom/vitest';
2
3 // XSpeedConfig is normally injected by wp_localize_script. In Vitest we
4 // shim a sensible default so components that read window.XSpeedConfig
5 // during render don't blow up. Individual tests override with stronger
6 // fixtures via vi.stubGlobal('XSpeedConfig', { ... }) as needed.
7 declare global {
8 interface Window {
9 XSpeedConfig: {
10 mode?: 'dashboard' | 'onboarding';
11 restUrl: string;
12 nonce: string;
13 version: string;
14 dashboardUrl?: string;
15 bootstrap?: any;
16 };
17 }
18 }
19
20 if (typeof window !== 'undefined') {
21 window.XSpeedConfig = window.XSpeedConfig ?? {
22 restUrl: 'http://localhost/wp-json/xspeed/v1',
23 nonce: 'test-nonce',
24 version: '1.0.0-test',
25 };
26 }
27