2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2023-08-01 17:16:39 +09:00
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey, cherrypick contributors
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-03-09 12:48:39 +09:00
|
|
|
import { vi } from 'vitest';
|
2023-03-19 16:59:31 +09:00
|
|
|
import createFetchMock from 'vitest-fetch-mock';
|
|
|
|
|
|
|
|
const fetchMocker = createFetchMock(vi);
|
|
|
|
fetchMocker.enableMocks();
|
2023-03-09 12:48:39 +09:00
|
|
|
|
|
|
|
// Set i18n
|
|
|
|
import locales from '../../../locales';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { updateI18n } from '@/i18n.js';
|
2023-03-09 12:48:39 +09:00
|
|
|
updateI18n(locales['en-US']);
|
|
|
|
|
2023-06-12 16:35:30 +09:00
|
|
|
// XXX: cherrypick-js panics if WebSocket is not defined
|
2023-03-09 12:48:39 +09:00
|
|
|
vi.stubGlobal('WebSocket', class WebSocket extends EventTarget { static CLOSING = 2; });
|
|
|
|
|
|
|
|
// XXX: defaultStore somehow becomes undefined in vitest?
|
|
|
|
vi.mock('@/store.js', () => {
|
|
|
|
return {
|
|
|
|
defaultStore: {
|
|
|
|
state: {},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|