use oxfmt instead of prettier

This commit is contained in:
pa
2026-03-13 22:30:12 +09:00
parent 82122a4fab
commit 7b7c1b4568
155 changed files with 3467 additions and 1631 deletions

View File

@@ -6,15 +6,34 @@ const mocks = vi.hoisted(() => ({
addFavorite: vi.fn(() => Promise.resolve()),
deleteFavoriteNoConfirm: vi.fn(),
toastSuccess: vi.fn(),
favoriteDialog: { __v_isRef: true, value: { visible: true, type: 'friend', objectId: 'usr_1', currentGroup: null } }
favoriteDialog: {
__v_isRef: true,
value: {
visible: true,
type: 'friend',
objectId: 'usr_1',
currentGroup: null
}
}
}));
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k) => k }) }));
vi.mock('vue-sonner', () => ({ toast: { success: (...a) => mocks.toastSuccess(...a) } }));
vi.mock('vue-sonner', () => ({
toast: { success: (...a) => mocks.toastSuccess(...a) }
}));
vi.mock('../../../stores', () => ({
useFavoriteStore: () => ({
favoriteFriendGroups: ref([{ key: 'group_1', type: 'friend', name: 'group_1', displayName: 'G1', count: 0, capacity: 100 }]),
favoriteFriendGroups: ref([
{
key: 'group_1',
type: 'friend',
name: 'group_1',
displayName: 'G1',
count: 0,
capacity: 100
}
]),
favoriteAvatarGroups: ref([]),
favoriteWorldGroups: ref([]),
favoriteDialog: mocks.favoriteDialog,
@@ -31,9 +50,22 @@ vi.mock('../../../stores', () => ({
}),
useUserStore: () => ({ isLocalUserVrcPlusSupporter: ref(true) })
}));
vi.mock('../../../api', () => ({ favoriteRequest: { addFavorite: (...a) => mocks.addFavorite(...a) } }));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('../../../api', () => ({
favoriteRequest: { addFavorite: (...a) => mocks.addFavorite(...a) }
}));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('lucide-vue-next', () => ({ Check: { template: '<i />' } }));
import ChooseFavoriteGroupDialog from '../ChooseFavoriteGroupDialog.vue';
@@ -42,7 +74,12 @@ describe('ChooseFavoriteGroupDialog.vue', () => {
beforeEach(() => {
mocks.addFavorite.mockClear();
mocks.toastSuccess.mockClear();
mocks.favoriteDialog.value = { visible: true, type: 'friend', objectId: 'usr_1', currentGroup: null };
mocks.favoriteDialog.value = {
visible: true,
type: 'friend',
objectId: 'usr_1',
currentGroup: null
};
});
it('runs delete action for current group', async () => {
@@ -50,7 +87,12 @@ describe('ChooseFavoriteGroupDialog.vue', () => {
visible: true,
type: 'friend',
objectId: 'usr_1',
currentGroup: { key: 'group_1', displayName: 'G1', count: 0, capacity: 100 }
currentGroup: {
key: 'group_1',
displayName: 'G1',
count: 0,
capacity: 100
}
};
const wrapper = mount(ChooseFavoriteGroupDialog);
await wrapper.get('[data-testid="btn"]').trigger('click');

View File

@@ -5,8 +5,16 @@ vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k) => k }) }));
vi.mock('@/shared/utils/common', () => ({ openExternalLink: vi.fn() }));
vi.mock('../../../stores', () => ({
useDashboardStore: () => ({
createDashboard: vi.fn(async () => ({ id: 'dashboard-1', name: 'Dashboard', icon: 'ri-dashboard-line' })),
getDashboard: vi.fn(() => ({ id: 'dashboard-1', name: 'Dashboard', icon: 'ri-dashboard-line' })),
createDashboard: vi.fn(async () => ({
id: 'dashboard-1',
name: 'Dashboard',
icon: 'ri-dashboard-line'
})),
getDashboard: vi.fn(() => ({
id: 'dashboard-1',
name: 'Dashboard',
icon: 'ri-dashboard-line'
})),
updateDashboard: vi.fn(async () => {}),
deleteDashboard: vi.fn(async () => {}),
setEditingDashboardId: vi.fn()
@@ -25,7 +33,8 @@ vi.mock('@/components/ui/dialog', () => ({
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/hover-card', () => ({
@@ -37,17 +46,26 @@ vi.mock('@/components/ui/input-group', () => ({
InputGroupButton: { template: '<button><slot /></button>' },
InputGroupField: { template: '<input />' }
}));
vi.mock('@/components/ui/separator', () => ({ Separator: { template: '<hr />' } }));
vi.mock('@/components/ui/separator', () => ({
Separator: { template: '<hr />' }
}));
vi.mock('@/components/ui/tree', () => ({
Tree: {
props: ['items'],
template: '<div><slot :flatten-items="[]" /></div>'
}
}));
vi.mock('@dnd-kit/vue', () => ({ DragDropProvider: { template: '<div><slot /></div>' } }));
vi.mock('@dnd-kit/vue', () => ({
DragDropProvider: { template: '<div><slot /></div>' }
}));
vi.mock('@dnd-kit/vue/sortable', () => ({ isSortable: () => false }));
vi.mock('lucide-vue-next', () => new Proxy({}, { get: () => ({ template: '<i />' }) }));
vi.mock('../SortableTreeNode.vue', () => ({ default: { template: '<div />' } }));
vi.mock(
'lucide-vue-next',
() => new Proxy({}, { get: () => ({ template: '<i />' }) })
);
vi.mock('../SortableTreeNode.vue', () => ({
default: { template: '<div />' }
}));
import CustomNavDialog from '../CustomNavDialog.vue';
@@ -74,8 +92,12 @@ describe('CustomNavDialog.vue', () => {
});
const buttons = wrapper.findAll('[data-testid="btn"]');
const resetButton = buttons.find((button) => button.text().includes('nav_menu.custom_nav.restore_default'));
const saveButton = buttons.find((button) => button.text().includes('common.actions.confirm'));
const resetButton = buttons.find((button) =>
button.text().includes('nav_menu.custom_nav.restore_default')
);
const saveButton = buttons.find((button) =>
button.text().includes('common.actions.confirm')
);
await resetButton.trigger('click');
await saveButton.trigger('click');

View File

@@ -19,13 +19,36 @@ vi.mock('../../composables/useImageCropper', () => ({
getCroppedBlob: (...a) => mocks.getCroppedBlob(...a)
})
}));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' }, DialogFooter: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/slider', () => ({ Slider: { emits: ['value-commit'], template: '<div />' } }));
vi.mock('@/components/ui/spinner', () => ({ Spinner: { template: '<div />' } }));
vi.mock('@/components/ui/tooltip/TooltipWrapper.vue', () => ({ default: { template: '<div><slot /></div>' } }));
vi.mock('vue-advanced-cropper', () => ({ Cropper: { emits: ['change'], template: '<div />' } }));
vi.mock('lucide-vue-next', () => new Proxy({}, { get: () => ({ template: '<i />' }) }));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' },
DialogFooter: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/slider', () => ({
Slider: { emits: ['value-commit'], template: '<div />' }
}));
vi.mock('@/components/ui/spinner', () => ({
Spinner: { template: '<div />' }
}));
vi.mock('@/components/ui/tooltip/TooltipWrapper.vue', () => ({
default: { template: '<div><slot /></div>' }
}));
vi.mock('vue-advanced-cropper', () => ({
Cropper: { emits: ['change'], template: '<div />' }
}));
vi.mock(
'lucide-vue-next',
() => new Proxy({}, { get: () => ({ template: '<i />' }) })
);
import ImageCropDialog from '../ImageCropDialog.vue';

View File

@@ -10,24 +10,71 @@ const mocks = vi.hoisted(() => ({
setString: vi.fn(),
getString: vi.fn(async () => ''),
applyGroup: vi.fn((g) => g),
inviteDialog: { __v_isRef: true, value: { visible: true, loading: false, groupId: 'grp_1', userId: '', userIds: ['usr_1'], groupName: '', userObject: null } }
inviteDialog: {
__v_isRef: true,
value: {
visible: true,
loading: false,
groupId: 'grp_1',
userId: '',
userIds: ['usr_1'],
groupName: '',
userObject: null
}
}
}));
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k) => k }) }));
vi.mock('vue-sonner', () => ({ toast: { error: vi.fn() } }));
vi.mock('../../../shared/utils', () => ({ hasGroupPermission: () => true }));
vi.mock('../../../composables/useUserDisplay', () => ({ useUserDisplay: () => ({ userImage: () => '', userStatusClass: () => '' }) }));
vi.mock('../../../composables/useUserDisplay', () => ({
useUserDisplay: () => ({ userImage: () => '', userStatusClass: () => '' })
}));
vi.mock('../../../stores', () => ({
useFriendStore: () => ({ vipFriends: ref([]), onlineFriends: ref([]), activeFriends: ref([]), offlineFriends: ref([]) }),
useGroupStore: () => ({ currentUserGroups: ref(new Map()), inviteGroupDialog: mocks.inviteDialog, applyGroup: (...a) => mocks.applyGroup(...a) }),
useFriendStore: () => ({
vipFriends: ref([]),
onlineFriends: ref([]),
activeFriends: ref([]),
offlineFriends: ref([])
}),
useGroupStore: () => ({
currentUserGroups: ref(new Map()),
inviteGroupDialog: mocks.inviteDialog,
applyGroup: (...a) => mocks.applyGroup(...a)
}),
useModalStore: () => ({ confirm: (...a) => mocks.confirm(...a) })
}));
vi.mock('../../../api', () => ({ groupRequest: { sendGroupInvite: (...a) => mocks.sendGroupInvite(...a), getGroup: (...a) => mocks.getGroup(...a) }, queryRequest: { fetch: (...a) => mocks.fetch(...a) } }));
vi.mock('../../../services/config', () => ({ default: { getString: (...a) => mocks.getString(...a), setString: (...a) => mocks.setString(...a) } }));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' }, DialogFooter: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('../../ui/virtual-combobox', () => ({ VirtualCombobox: { template: '<div />' } }));
vi.mock('../../../api', () => ({
groupRequest: {
sendGroupInvite: (...a) => mocks.sendGroupInvite(...a),
getGroup: (...a) => mocks.getGroup(...a)
},
queryRequest: { fetch: (...a) => mocks.fetch(...a) }
}));
vi.mock('../../../services/config', () => ({
default: {
getString: (...a) => mocks.getString(...a),
setString: (...a) => mocks.setString(...a)
}
}));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' },
DialogFooter: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('../../ui/virtual-combobox', () => ({
VirtualCombobox: { template: '<div />' }
}));
vi.mock('lucide-vue-next', () => ({ Check: { template: '<i />' } }));
import InviteGroupDialog from '../InviteGroupDialog.vue';

View File

@@ -6,10 +6,19 @@ const mocks = vi.hoisted(() => ({
selfInvite: vi.fn(async () => ({})),
writeText: vi.fn(),
getBool: vi.fn(async () => false),
launchDialogData: { value: { visible: true, loading: true, tag: 'wrld_1:123', shortName: 'abc' } }
launchDialogData: {
value: {
visible: true,
loading: true,
tag: 'wrld_1:123',
shortName: 'abc'
}
}
}));
Object.assign(globalThis, { navigator: { clipboard: { writeText: (...a) => mocks.writeText(...a) } } });
Object.assign(globalThis, {
navigator: { clipboard: { writeText: (...a) => mocks.writeText(...a) } }
});
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k) => k }) }));
@@ -18,27 +27,81 @@ vi.mock('../../../stores', () => ({
useFriendStore: () => ({ friends: ref(new Map()) }),
useGameStore: () => ({ isGameRunning: ref(false) }),
useInviteStore: () => ({ canOpenInstanceInGame: ref(false) }),
useLaunchStore: () => ({ launchDialogData: mocks.launchDialogData, launchGame: vi.fn(), tryOpenInstanceInVrc: vi.fn() }),
useLaunchStore: () => ({
launchDialogData: mocks.launchDialogData,
launchGame: vi.fn(),
tryOpenInstanceInVrc: vi.fn()
}),
useLocationStore: () => ({ lastLocation: ref({ friendList: new Map() }) }),
useModalStore: () => ({ confirm: vi.fn() })
}));
vi.mock('../../../shared/utils', () => ({
getLaunchURL: () => 'vrchat://launch',
isRealInstance: () => true,
parseLocation: () => ({ isRealInstance: true, worldId: 'wrld_1', instanceId: '123', tag: 'wrld_1:123' })
parseLocation: () => ({
isRealInstance: true,
worldId: 'wrld_1',
instanceId: '123',
tag: 'wrld_1:123'
})
}));
vi.mock('../../../composables/useInviteChecks', () => ({
useInviteChecks: () => ({ checkCanInvite: () => true })
}));
vi.mock('../../../api', () => ({
instanceRequest: {
selfInvite: (...a) => mocks.selfInvite(...a),
getInstanceShortName: vi.fn()
},
queryRequest: { fetch: vi.fn() }
}));
vi.mock('../../../services/config', () => ({
default: { getBool: (...a) => mocks.getBool(...a), setBool: vi.fn() }
}));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' },
DialogDescription: { template: '<div><slot /></div>' },
DialogFooter: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/dropdown-menu', () => ({
DropdownMenu: { template: '<div><slot /></div>' },
DropdownMenuTrigger: { template: '<div><slot /></div>' },
DropdownMenuContent: { template: '<div><slot /></div>' },
DropdownMenuItem: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/field', () => ({
Field: { template: '<div><slot /></div>' },
FieldGroup: { template: '<div><slot /></div>' },
FieldLabel: { template: '<div><slot /></div>' },
FieldContent: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/button-group', () => ({
ButtonGroup: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/input-group', () => ({
InputGroupField: { template: '<input />' }
}));
vi.mock('@/components/ui/tooltip', () => ({
TooltipWrapper: { template: '<div><slot /></div>' }
}));
vi.mock('../InviteDialog/InviteDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('lucide-vue-next', () => ({
Copy: { template: '<i />' },
Info: { template: '<i />' },
MoreHorizontal: { template: '<i />' }
}));
vi.mock('../../../composables/useInviteChecks', () => ({ useInviteChecks: () => ({ checkCanInvite: () => true }) }));
vi.mock('../../../api', () => ({ instanceRequest: { selfInvite: (...a) => mocks.selfInvite(...a), getInstanceShortName: vi.fn() }, queryRequest: { fetch: vi.fn() } }));
vi.mock('../../../services/config', () => ({ default: { getBool: (...a) => mocks.getBool(...a), setBool: vi.fn() } }));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' }, DialogDescription: { template: '<div><slot /></div>' }, DialogFooter: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/dropdown-menu', () => ({ DropdownMenu: { template: '<div><slot /></div>' }, DropdownMenuTrigger: { template: '<div><slot /></div>' }, DropdownMenuContent: { template: '<div><slot /></div>' }, DropdownMenuItem: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/field', () => ({ Field: { template: '<div><slot /></div>' }, FieldGroup: { template: '<div><slot /></div>' }, FieldLabel: { template: '<div><slot /></div>' }, FieldContent: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/button-group', () => ({ ButtonGroup: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/input-group', () => ({ InputGroupField: { template: '<input />' } }));
vi.mock('@/components/ui/tooltip', () => ({ TooltipWrapper: { template: '<div><slot /></div>' } }));
vi.mock('../InviteDialog/InviteDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('lucide-vue-next', () => ({ Copy: { template: '<i />' }, Info: { template: '<i />' }, MoreHorizontal: { template: '<i />' } }));
import LaunchDialog from '../LaunchDialog.vue';

View File

@@ -5,31 +5,83 @@ import { ref } from 'vue';
const mocks = vi.hoisted(() => ({
closeMainDialog: vi.fn(),
handleBreadcrumbClick: vi.fn(),
dialogCrumbs: { value: [{ type: 'user', id: 'u1', label: 'User' }, { type: 'world', id: 'w1', label: 'World' }] },
dialogCrumbs: {
value: [
{ type: 'user', id: 'u1', label: 'User' },
{ type: 'world', id: 'w1', label: 'World' }
]
},
userVisible: { value: true }
}));
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('@/stores', () => ({
useUiStore: () => ({ dialogCrumbs: mocks.dialogCrumbs.value, closeMainDialog: (...a) => mocks.closeMainDialog(...a), handleBreadcrumbClick: (...a) => mocks.handleBreadcrumbClick(...a) }),
useUiStore: () => ({
dialogCrumbs: mocks.dialogCrumbs.value,
closeMainDialog: (...a) => mocks.closeMainDialog(...a),
handleBreadcrumbClick: (...a) => mocks.handleBreadcrumbClick(...a)
}),
useUserStore: () => ({ userDialog: { visible: mocks.userVisible.value } }),
useWorldStore: () => ({ worldDialog: { visible: false } }),
useAvatarStore: () => ({ avatarDialog: { visible: false } }),
useGroupStore: () => ({ groupDialog: { visible: false } }),
useInstanceStore: () => ({ previousInstancesInfoDialog: ref({ visible: false }), previousInstancesListDialog: ref({ visible: false, variant: 'user' }) })
useInstanceStore: () => ({
previousInstancesInfoDialog: ref({ visible: false }),
previousInstancesListDialog: ref({ visible: false, variant: 'user' })
})
}));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/breadcrumb', () => ({
Breadcrumb: { template: '<div><slot /></div>' },
BreadcrumbList: { template: '<div><slot /></div>' },
BreadcrumbItem: { template: '<div><slot /></div>' },
BreadcrumbLink: { template: '<div><slot /></div>' },
BreadcrumbSeparator: { template: '<span>/</span>' },
BreadcrumbPage: { template: '<span><slot /></span>' },
BreadcrumbEllipsis: { template: '<span>...</span>' }
}));
vi.mock('@/components/ui/dropdown-menu', () => ({
DropdownMenu: { template: '<div><slot /></div>' },
DropdownMenuTrigger: { template: '<div><slot /></div>' },
DropdownMenuContent: { template: '<div><slot /></div>' },
DropdownMenuItem: {
emits: ['click'],
template:
'<button data-testid="crumb-dd" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/tooltip', () => ({
TooltipWrapper: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/breadcrumb', () => ({ Breadcrumb: { template: '<div><slot /></div>' }, BreadcrumbList: { template: '<div><slot /></div>' }, BreadcrumbItem: { template: '<div><slot /></div>' }, BreadcrumbLink: { template: '<div><slot /></div>' }, BreadcrumbSeparator: { template: '<span>/</span>' }, BreadcrumbPage: { template: '<span><slot /></span>' }, BreadcrumbEllipsis: { template: '<span>...</span>' } }));
vi.mock('@/components/ui/dropdown-menu', () => ({ DropdownMenu: { template: '<div><slot /></div>' }, DropdownMenuTrigger: { template: '<div><slot /></div>' }, DropdownMenuContent: { template: '<div><slot /></div>' }, DropdownMenuItem: { emits: ['click'], template: '<button data-testid="crumb-dd" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/tooltip', () => ({ TooltipWrapper: { template: '<div><slot /></div>' } }));
vi.mock('lucide-vue-next', () => ({ ArrowLeft: { template: '<i />' } }));
vi.mock('../AvatarDialog/AvatarDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../GroupDialog/GroupDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../PreviousInstancesDialog/PreviousInstancesInfoDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../PreviousInstancesDialog/PreviousInstancesListDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../UserDialog/UserDialog.vue', () => ({ default: { template: '<div data-testid="user-dialog" />' } }));
vi.mock('../WorldDialog/WorldDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../AvatarDialog/AvatarDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../GroupDialog/GroupDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../PreviousInstancesDialog/PreviousInstancesInfoDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../PreviousInstancesDialog/PreviousInstancesListDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../UserDialog/UserDialog.vue', () => ({
default: { template: '<div data-testid="user-dialog" />' }
}));
vi.mock('../WorldDialog/WorldDialog.vue', () => ({
default: { template: '<div />' }
}));
import MainDialogContainer from '../MainDialogContainer.vue';

View File

@@ -9,16 +9,47 @@ const mocks = vi.hoisted(() => ({
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (k) => k }) }));
vi.mock('../../../api', () => ({ miscRequest: { sendBoop: (...a) => mocks.sendBoop(...a) }, notificationRequest: { hideNotificationV2: vi.fn() }, queryRequest: { fetch: (...a) => mocks.fetch(...a) } }));
vi.mock('../../../stores', () => ({
useUserStore: () => ({ sendBoopDialog: mocks.boopDialog, isLocalUserVrcPlusSupporter: { value: false } }),
useNotificationStore: () => ({ notificationTable: { value: { data: [] } }, isNotificationExpired: () => false, handleNotificationV2Hide: vi.fn() }),
useGalleryStore: () => ({ showGalleryPage: vi.fn(), refreshEmojiTable: vi.fn(), emojiTable: { value: [] } })
vi.mock('../../../api', () => ({
miscRequest: { sendBoop: (...a) => mocks.sendBoop(...a) },
notificationRequest: { hideNotificationV2: vi.fn() },
queryRequest: { fetch: (...a) => mocks.fetch(...a) }
}));
vi.mock('../../../stores', () => ({
useUserStore: () => ({
sendBoopDialog: mocks.boopDialog,
isLocalUserVrcPlusSupporter: { value: false }
}),
useNotificationStore: () => ({
notificationTable: { value: { data: [] } },
isNotificationExpired: () => false,
handleNotificationV2Hide: vi.fn()
}),
useGalleryStore: () => ({
showGalleryPage: vi.fn(),
refreshEmojiTable: vi.fn(),
emojiTable: { value: [] }
})
}));
vi.mock('../../../shared/constants/photon.js', () => ({
photonEmojis: ['Wave']
}));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' },
DialogFooter: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('../../ui/virtual-combobox', () => ({
VirtualCombobox: { template: '<div />' }
}));
vi.mock('../../../shared/constants/photon.js', () => ({ photonEmojis: ['Wave'] }));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' }, DialogFooter: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('../../ui/virtual-combobox', () => ({ VirtualCombobox: { template: '<div />' } }));
vi.mock('../../Emoji.vue', () => ({ default: { template: '<div />' } }));
vi.mock('lucide-vue-next', () => ({ Check: { template: '<i />' } }));

View File

@@ -4,7 +4,9 @@ import { mount } from '@vue/test-utils';
const mocks = vi.hoisted(() => ({
close: vi.fn(),
save: vi.fn(),
dialog: { value: { visible: true, maxTableSize: '1000', searchLimit: '100' } }
dialog: {
value: { visible: true, maxTableSize: '1000', searchLimit: '100' }
}
}));
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
@@ -20,10 +22,30 @@ vi.mock('../../../stores', () => ({
SEARCH_LIMIT_MAX: 1000
})
}));
vi.mock('@/components/ui/dialog', () => ({ Dialog: { template: '<div><slot /></div>' }, DialogContent: { template: '<div><slot /></div>' }, DialogHeader: { template: '<div><slot /></div>' }, DialogTitle: { template: '<div><slot /></div>' }, DialogDescription: { template: '<div><slot /></div>' }, DialogFooter: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/field', () => ({ Field: { template: '<div><slot /></div>' }, FieldGroup: { template: '<div><slot /></div>' }, FieldLabel: { template: '<div><slot /></div>' }, FieldContent: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" :disabled="$attrs.disabled" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/input-group', () => ({ InputGroupField: { template: '<input />' } }));
vi.mock('@/components/ui/dialog', () => ({
Dialog: { template: '<div><slot /></div>' },
DialogContent: { template: '<div><slot /></div>' },
DialogHeader: { template: '<div><slot /></div>' },
DialogTitle: { template: '<div><slot /></div>' },
DialogDescription: { template: '<div><slot /></div>' },
DialogFooter: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/field', () => ({
Field: { template: '<div><slot /></div>' },
FieldGroup: { template: '<div><slot /></div>' },
FieldLabel: { template: '<div><slot /></div>' },
FieldContent: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" :disabled="$attrs.disabled" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/input-group', () => ({
InputGroupField: { template: '<input />' }
}));
import TableLimitsDialog from '../TableLimitsDialog.vue';