mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
refactor store
This commit is contained in:
@@ -81,6 +81,12 @@ vi.mock('../../service/watchState', () => ({
|
||||
watchState: { isLoggedIn: false }
|
||||
}));
|
||||
|
||||
import * as avatarCoordinatorModule from '../../coordinators/avatarCoordinator';
|
||||
vi.mock('../../coordinators/avatarCoordinator', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return { ...actual, showAvatarAuthorDialog: vi.fn() };
|
||||
});
|
||||
|
||||
const i18n = createI18n({
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
@@ -210,9 +216,7 @@ describe('AvatarInfo.vue', () => {
|
||||
test('does not call showAvatarAuthorDialog when no imageurl', async () => {
|
||||
const wrapper = mountAvatarInfo({});
|
||||
await wrapper.trigger('click');
|
||||
const { useAvatarStore } = await import('../../stores');
|
||||
const avatarStore = useAvatarStore();
|
||||
expect(avatarStore.showAvatarAuthorDialog).not.toHaveBeenCalled();
|
||||
expect(avatarCoordinatorModule.showAvatarAuthorDialog).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -142,15 +142,15 @@
|
||||
const { userDialog, languageDialog, currentUser, isLocalUserVrcPlusSupporter } = storeToRefs(useUserStore());
|
||||
const { cachedUsers, showSendBoopDialog } = useUserStore();
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
import { showAvatarDialog, showAvatarAuthorDialog } from '../../../coordinators/avatarCoordinator';
|
||||
import { showAvatarDialog, showAvatarAuthorDialog } from '../../../coordinators/avatarCoordinator';
|
||||
import { showUserDialog, refreshUserDialogAvatars } from '../../../coordinators/userCoordinator';
|
||||
import { getFriendRequest, handleFriendDelete } from '../../../coordinators/friendRelationshipCoordinator';
|
||||
|
||||
const { showModerateGroupDialog } = useGroupStore();
|
||||
const { inviteGroupDialog } = storeToRefs(useGroupStore());
|
||||
const { lastLocation, lastLocationDestination } = storeToRefs(useLocationStore());
|
||||
const { refreshInviteMessageTableData } = useInviteStore();
|
||||
const { friendLogTable } = storeToRefs(useFriendStore());
|
||||
const { getFriendRequest, handleFriendDelete } = useFriendStore();
|
||||
const { clearInviteImageUpload, showGalleryPage } = useGalleryStore();
|
||||
|
||||
const { applyPlayerModeration, handlePlayerModerationDelete } = useModerationStore();
|
||||
|
||||
@@ -84,6 +84,12 @@ vi.mock('../../../../service/request', () => ({
|
||||
failedGetRequests: new Map()
|
||||
}));
|
||||
|
||||
import * as userCoordinatorModule from '../../../../coordinators/userCoordinator';
|
||||
vi.mock('../../../../coordinators/userCoordinator', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return { ...actual, showUserDialog: vi.fn() };
|
||||
});
|
||||
|
||||
import UserDialogMutualFriendsTab from '../UserDialogMutualFriendsTab.vue';
|
||||
import { useUserStore } from '../../../../stores';
|
||||
import { userDialogMutualFriendSortingOptions } from '../../../../shared/constants';
|
||||
@@ -219,7 +225,7 @@ describe('UserDialogMutualFriendsTab.vue', () => {
|
||||
};
|
||||
userStore.currentUser = { id: 'usr_me' };
|
||||
const showUserDialogSpy = vi
|
||||
.spyOn(userStore, 'showUserDialog')
|
||||
.spyOn(userCoordinatorModule, 'showUserDialog')
|
||||
.mockImplementation(() => {});
|
||||
|
||||
const wrapper = mount(UserDialogMutualFriendsTab, {
|
||||
|
||||
@@ -88,6 +88,12 @@ vi.mock('../../../../service/request', () => ({
|
||||
failedGetRequests: new Map()
|
||||
}));
|
||||
|
||||
import * as worldCoordinatorModule from '../../../../coordinators/worldCoordinator';
|
||||
vi.mock('../../../../coordinators/worldCoordinator', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return { ...actual, showWorldDialog: vi.fn() };
|
||||
});
|
||||
|
||||
import UserDialogWorldsTab from '../UserDialogWorldsTab.vue';
|
||||
import { useUserStore } from '../../../../stores';
|
||||
import {
|
||||
@@ -235,10 +241,8 @@ describe('UserDialogWorldsTab.vue', () => {
|
||||
test('calls showWorldDialog when a world is clicked', async () => {
|
||||
const pinia = createTestingPinia({ stubActions: false });
|
||||
const userStore = useUserStore(pinia);
|
||||
const { useWorldStore } = await import('../../../../stores');
|
||||
const worldStore = useWorldStore(pinia);
|
||||
const showWorldDialogSpy = vi
|
||||
.spyOn(worldStore, 'showWorldDialog')
|
||||
.spyOn(worldCoordinatorModule, 'showWorldDialog')
|
||||
.mockImplementation(() => {});
|
||||
|
||||
userStore.userDialog = {
|
||||
|
||||
Reference in New Issue
Block a user