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

@@ -21,37 +21,123 @@ vi.mock('@vueuse/core', async (importOriginal) => {
};
});
vi.mock('../../../stores', () => ({
useFriendStore: () => ({ friends: ref(new Map()), isRefreshFriendsLoading: ref(false), onlineFriendCount: ref(0) }),
useFriendStore: () => ({
friends: ref(new Map()),
isRefreshFriendsLoading: ref(false),
onlineFriendCount: ref(0)
}),
useGroupStore: () => ({ groupInstances: ref([]) }),
useNotificationStore: () => ({ isNotificationCenterOpen: mocks.centerOpen, hasUnseenNotifications: mocks.hasUnseen, markAllAsSeen: (...a) => mocks.markAllAsSeen(...a) }),
useAppearanceSettingsStore: () => ({ sidebarSortMethod1: ref(''), sidebarSortMethod2: ref(''), sidebarSortMethod3: ref(''), isSidebarGroupByInstance: ref(false), isHideFriendsInSameInstance: ref(false), isSidebarDivideByFriendGroup: ref(false), sidebarFavoriteGroups: ref([]), setSidebarSortMethod1: vi.fn(), setSidebarSortMethod2: vi.fn(), setSidebarSortMethod3: vi.fn(), setIsSidebarGroupByInstance: vi.fn(), setIsHideFriendsInSameInstance: vi.fn(), setIsSidebarDivideByFriendGroup: vi.fn(), setSidebarFavoriteGroups: vi.fn() }),
useFavoriteStore: () => ({ favoriteFriendGroups: ref([]), localFriendFavoriteGroups: ref([]) })
useNotificationStore: () => ({
isNotificationCenterOpen: mocks.centerOpen,
hasUnseenNotifications: mocks.hasUnseen,
markAllAsSeen: (...a) => mocks.markAllAsSeen(...a)
}),
useAppearanceSettingsStore: () => ({
sidebarSortMethod1: ref(''),
sidebarSortMethod2: ref(''),
sidebarSortMethod3: ref(''),
isSidebarGroupByInstance: ref(false),
isHideFriendsInSameInstance: ref(false),
isSidebarDivideByFriendGroup: ref(false),
sidebarFavoriteGroups: ref([]),
setSidebarSortMethod1: vi.fn(),
setSidebarSortMethod2: vi.fn(),
setSidebarSortMethod3: vi.fn(),
setIsSidebarGroupByInstance: vi.fn(),
setIsHideFriendsInSameInstance: vi.fn(),
setIsSidebarDivideByFriendGroup: vi.fn(),
setSidebarFavoriteGroups: vi.fn()
}),
useFavoriteStore: () => ({
favoriteFriendGroups: ref([]),
localFriendFavoriteGroups: ref([])
})
}));
vi.mock('../../../stores/globalSearch', () => ({
useGlobalSearchStore: () => ({ open: (...a) => mocks.openSearch(...a) })
}));
vi.mock('../../../coordinators/friendSyncCoordinator', () => ({
runRefreshFriendsListFlow: (...a) => mocks.refreshFriends(...a)
}));
vi.mock('../sidebarSettingsUtils', () => ({
normalizeFavoriteGroupsChange: (v) => v,
resolveFavoriteGroups: (v) => v
}));
vi.mock('@/components/ui/button', () => ({
Button: {
emits: ['click'],
template:
'<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/context-menu', () => ({
ContextMenu: { template: '<div><slot /></div>' },
ContextMenuTrigger: { template: '<div><slot /></div>' },
ContextMenuContent: { template: '<div><slot /></div>' },
ContextMenuItem: {
emits: ['click'],
template:
'<button data-testid="ctx" @click="$emit(\'click\')"><slot /></button>'
}
}));
vi.mock('@/components/ui/popover', () => ({
Popover: { template: '<div><slot /></div>' },
PopoverTrigger: { template: '<div><slot /></div>' },
PopoverContent: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/select', () => ({
Select: { template: '<div><slot /></div>' },
SelectTrigger: { template: '<div><slot /></div>' },
SelectValue: { template: '<div><slot /></div>' },
SelectContent: { template: '<div><slot /></div>' },
SelectGroup: { template: '<div><slot /></div>' },
SelectItem: { template: '<div><slot /></div>' },
SelectSeparator: { template: '<hr />' }
}));
vi.mock('@/components/ui/field', () => ({
Field: { template: '<div><slot /></div>' },
FieldLabel: { template: '<div><slot /></div>' },
FieldContent: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/tabs', () => ({
TabsUnderline: {
template: '<div><slot name="friends" /><slot name="groups" /></div>'
}
}));
vi.mock('../../../stores/globalSearch', () => ({ useGlobalSearchStore: () => ({ open: (...a) => mocks.openSearch(...a) }) }));
vi.mock('../../../coordinators/friendSyncCoordinator', () => ({ runRefreshFriendsListFlow: (...a) => mocks.refreshFriends(...a) }));
vi.mock('../sidebarSettingsUtils', () => ({ normalizeFavoriteGroupsChange: (v) => v, resolveFavoriteGroups: (v) => v }));
vi.mock('@/components/ui/button', () => ({ Button: { emits: ['click'], template: '<button data-testid="btn" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/context-menu', () => ({ ContextMenu: { template: '<div><slot /></div>' }, ContextMenuTrigger: { template: '<div><slot /></div>' }, ContextMenuContent: { template: '<div><slot /></div>' }, ContextMenuItem: { emits: ['click'], template: '<button data-testid="ctx" @click="$emit(\'click\')"><slot /></button>' } }));
vi.mock('@/components/ui/popover', () => ({ Popover: { template: '<div><slot /></div>' }, PopoverTrigger: { template: '<div><slot /></div>' }, PopoverContent: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/select', () => ({ Select: { template: '<div><slot /></div>' }, SelectTrigger: { template: '<div><slot /></div>' }, SelectValue: { template: '<div><slot /></div>' }, SelectContent: { template: '<div><slot /></div>' }, SelectGroup: { template: '<div><slot /></div>' }, SelectItem: { template: '<div><slot /></div>' }, SelectSeparator: { template: '<hr />' } }));
vi.mock('@/components/ui/field', () => ({ Field: { template: '<div><slot /></div>' }, FieldLabel: { template: '<div><slot /></div>' }, FieldContent: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/tabs', () => ({ TabsUnderline: { template: '<div><slot name="friends" /><slot name="groups" /></div>' } }));
vi.mock('@/components/ui/switch', () => ({ Switch: { template: '<div />' } }));
vi.mock('@/components/ui/spinner', () => ({ Spinner: { template: '<div />' } }));
vi.mock('@/components/ui/tooltip', () => ({ TooltipWrapper: { template: '<div><slot /></div>' } }));
vi.mock('@/components/ui/kbd', () => ({ Kbd: { template: '<kbd><slot /></kbd>' } }));
vi.mock('@/components/ui/separator', () => ({ Separator: { template: '<hr />' } }));
vi.mock('@/components/ui/spinner', () => ({
Spinner: { template: '<div />' }
}));
vi.mock('@/components/ui/tooltip', () => ({
TooltipWrapper: { template: '<div><slot /></div>' }
}));
vi.mock('@/components/ui/kbd', () => ({
Kbd: { template: '<kbd><slot /></kbd>' }
}));
vi.mock('@/components/ui/separator', () => ({
Separator: { template: '<hr />' }
}));
vi.mock('lucide-vue-next', () => ({
Bell: { template: '<i />' },
RefreshCw: { template: '<i />' },
Search: { template: '<i />' },
Settings: { template: '<i />' }
}));
vi.mock('../components/FriendsSidebar.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../components/GroupsSidebar.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../components/GroupOrderSheet.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../components/NotificationCenterSheet.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../../../components/GlobalSearchDialog.vue', () => ({ default: { template: '<div />' } }));
vi.mock('../components/FriendsSidebar.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../components/GroupsSidebar.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../components/GroupOrderSheet.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../components/NotificationCenterSheet.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/GlobalSearchDialog.vue', () => ({
default: { template: '<div />' }
}));
import Sidebar from '../Sidebar.vue';

View File

@@ -70,9 +70,7 @@
const sortedUnseenNotifications = computed(() => [...props.notifications].sort((a, b) => getTs(b) - getTs(a)));
const sortedRecentNotifications = computed(() =>
[...props.recentNotifications].sort((a, b) => getTs(b) - getTs(a))
);
const sortedRecentNotifications = computed(() => [...props.recentNotifications].sort((a, b) => getTs(b) - getTs(a)));
const allRows = computed(() => {
const rows = [];

View File

@@ -43,10 +43,9 @@ vi.mock('../../../../shared/utils', () => ({
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key
,
locale: require('vue').ref('en')
})
t: (key) => key,
locale: require('vue').ref('en')
})
}));
vi.mock('@/components/ui/avatar', () => ({
@@ -175,9 +174,7 @@ describe('FriendItem.vue', () => {
expect(wrapper.text()).toContain('Ghost');
const button = wrapper.get('[data-testid="delete-button"]');
await button.trigger('click');
expect(mocks.confirmDeleteFriend).toHaveBeenCalledWith(
'usr_orphan'
);
expect(mocks.confirmDeleteFriend).toHaveBeenCalledWith('usr_orphan');
expect(mocks.showUserDialog).not.toHaveBeenCalled();
});
});

View File

@@ -21,7 +21,8 @@ const mocks = vi.hoisted(() => ({
}
]
},
sortGroupInstancesByInGame: (a, b) => a[0].group.name.localeCompare(b[0].group.name),
sortGroupInstancesByInGame: (a, b) =>
a[0].group.name.localeCompare(b[0].group.name),
showLaunchDialog: vi.fn(),
checkCanInviteSelf: vi.fn(() => true),
selfInvite: vi.fn().mockResolvedValue({}),
@@ -56,11 +57,15 @@ vi.mock('../../../../stores', () => ({
sortGroupInstancesByInGame: mocks.sortGroupInstancesByInGame,
groupInstances: mocks.groupInstances
}),
useLaunchStore: () => ({ showLaunchDialog: (...a) => mocks.showLaunchDialog(...a) })
useLaunchStore: () => ({
showLaunchDialog: (...a) => mocks.showLaunchDialog(...a)
})
}));
vi.mock('../../../../composables/useInviteChecks', () => ({
useInviteChecks: () => ({ checkCanInviteSelf: (...a) => mocks.checkCanInviteSelf(...a) })
useInviteChecks: () => ({
checkCanInviteSelf: (...a) => mocks.checkCanInviteSelf(...a)
})
}));
vi.mock('../../../../shared/utils', () => ({
@@ -105,7 +110,10 @@ vi.mock('../../../../components/BackToTop.vue', () => ({
}));
vi.mock('../../../../components/Location.vue', () => ({
default: { props: ['location'], template: '<span data-testid="location">{{ location }}</span>' }
default: {
props: ['location'],
template: '<span data-testid="location">{{ location }}</span>'
}
}));
vi.mock('lucide-vue-next', () => ({
@@ -140,6 +148,8 @@ describe('GroupsSidebar.vue', () => {
worldId: 'wrld_1',
instanceId: '123'
});
expect(mocks.toastSuccess).toHaveBeenCalledWith('message.invite.self_sent');
expect(mocks.toastSuccess).toHaveBeenCalledWith(
'message.invite.self_sent'
);
});
});

View File

@@ -25,10 +25,9 @@ vi.mock('vue-router', () => ({
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key
,
locale: require('vue').ref('en')
})
t: (key) => key,
locale: require('vue').ref('en')
})
}));
vi.mock('../../../../stores', () => ({
@@ -136,9 +135,9 @@ describe('NotificationCenterSheet.vue', () => {
mocks.notificationStore.isNotificationCenterOpen.value = true;
await wrapper.vm.$nextTick();
expect(wrapper.get('[data-testid="tabs"]').attributes('data-model-value')).toBe(
'group'
);
expect(
wrapper.get('[data-testid="tabs"]').attributes('data-model-value')
).toBe('group');
});
test('navigate-to-table closes center and routes to notification page', async () => {
@@ -150,7 +149,9 @@ describe('NotificationCenterSheet.vue', () => {
expect(mocks.notificationStore.isNotificationCenterOpen.value).toBe(
false
);
expect(mocks.router.push).toHaveBeenCalledWith({ name: 'notification' });
expect(mocks.router.push).toHaveBeenCalledWith({
name: 'notification'
});
});
test('show invite response/request dialogs trigger side effects', async () => {
@@ -160,21 +161,23 @@ describe('NotificationCenterSheet.vue', () => {
.get('[data-testid="emit-show-invite-response"]')
.trigger('click');
expect(mocks.inviteStore.refreshInviteMessageTableData).toHaveBeenCalledWith(
'response'
);
expect(
mocks.inviteStore.refreshInviteMessageTableData
).toHaveBeenCalledWith('response');
expect(mocks.galleryStore.clearInviteImageUpload).toHaveBeenCalled();
expect(
wrapper.get('[data-testid="dialog-response"]').attributes('data-visible')
wrapper
.get('[data-testid="dialog-response"]')
.attributes('data-visible')
).toBe('true');
await wrapper
.get('[data-testid="emit-show-invite-request-response"]')
.trigger('click');
expect(mocks.inviteStore.refreshInviteMessageTableData).toHaveBeenCalledWith(
'requestResponse'
);
expect(
mocks.inviteStore.refreshInviteMessageTableData
).toHaveBeenCalledWith('requestResponse');
expect(
wrapper
.get('[data-testid="dialog-request-response"]')

View File

@@ -21,10 +21,9 @@ vi.mock('@tanstack/vue-virtual', () => ({
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key
,
locale: require('vue').ref('en')
})
t: (key) => key,
locale: require('vue').ref('en')
})
}));
vi.mock('@/components/ui/button', () => ({
@@ -83,7 +82,9 @@ describe('NotificationList.vue', () => {
makeNoty('old', '2026-03-08T00:00:00.000Z'),
makeNoty('new', '2026-03-09T00:00:00.000Z')
],
recentNotifications: [makeNoty('recent1', '2026-03-07T00:00:00.000Z')]
recentNotifications: [
makeNoty('recent1', '2026-03-07T00:00:00.000Z')
]
}
});
@@ -118,7 +119,9 @@ describe('NotificationList.vue', () => {
}
});
await wrapper.get('[data-testid="emit-invite-response"]').trigger('click');
await wrapper
.get('[data-testid="emit-invite-response"]')
.trigger('click');
await wrapper
.get('[data-testid="emit-invite-request-response"]')
.trigger('click');