mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-30 04:03:48 +02:00
use oxfmt instead of prettier
This commit is contained in:
@@ -71,7 +71,8 @@ vi.mock('../../../stores', () => ({
|
||||
}),
|
||||
useFavoriteStore: () => ({
|
||||
favoriteFriendGroups: mocks.favoriteFriendGroups,
|
||||
groupedByGroupKeyFavoriteFriends: mocks.groupedByGroupKeyFavoriteFriends,
|
||||
groupedByGroupKeyFavoriteFriends:
|
||||
mocks.groupedByGroupKeyFavoriteFriends,
|
||||
localFriendFavorites: mocks.localFriendFavorites
|
||||
}),
|
||||
useLocationStore: () => ({
|
||||
@@ -193,7 +194,8 @@ vi.mock('../../../components/ui/switch', () => ({
|
||||
vi.mock('../components/FriendsLocationsCard.vue', () => ({
|
||||
default: {
|
||||
props: ['friend'],
|
||||
template: '<div data-testid="friend-card">{{ friend.displayName }}</div>'
|
||||
template:
|
||||
'<div data-testid="friend-card">{{ friend.displayName }}</div>'
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -244,12 +246,17 @@ describe('FriendsLocations.vue', () => {
|
||||
mocks.configSetBool.mockReset();
|
||||
mocks.virtualMeasure.mockReset();
|
||||
|
||||
mocks.configGetString.mockImplementation((_key, defaultValue) => Promise.resolve(defaultValue ?? '1'));
|
||||
mocks.configGetString.mockImplementation((_key, defaultValue) =>
|
||||
Promise.resolve(defaultValue ?? '1')
|
||||
);
|
||||
mocks.configGetBool.mockResolvedValue(false);
|
||||
});
|
||||
|
||||
test('renders online friend cards after initial settings load', async () => {
|
||||
mocks.onlineFriends.value = [makeFriend('usr_1', 'Alice'), makeFriend('usr_2', 'Bob')];
|
||||
mocks.onlineFriends.value = [
|
||||
makeFriend('usr_1', 'Alice'),
|
||||
makeFriend('usr_2', 'Bob')
|
||||
];
|
||||
const wrapper = mount(FriendsLocations);
|
||||
await flushSettings();
|
||||
|
||||
@@ -258,11 +265,16 @@ describe('FriendsLocations.vue', () => {
|
||||
});
|
||||
|
||||
test('filters cards by search text in DOM', async () => {
|
||||
mocks.onlineFriends.value = [makeFriend('usr_1', 'Alice'), makeFriend('usr_2', 'Bob')];
|
||||
mocks.onlineFriends.value = [
|
||||
makeFriend('usr_1', 'Alice'),
|
||||
makeFriend('usr_2', 'Bob')
|
||||
];
|
||||
const wrapper = mount(FriendsLocations);
|
||||
await flushSettings();
|
||||
|
||||
await wrapper.get('[data-testid="friend-locations-search"]').setValue('bob');
|
||||
await wrapper
|
||||
.get('[data-testid="friend-locations-search"]')
|
||||
.setValue('bob');
|
||||
await flushSettings();
|
||||
|
||||
const cards = wrapper.findAll('[data-testid="friend-card"]');
|
||||
@@ -287,16 +299,26 @@ describe('FriendsLocations.vue', () => {
|
||||
await flushSettings();
|
||||
|
||||
await wrapper.get('[data-testid="set-scale"]').trigger('click');
|
||||
await wrapper.get('[data-testid="toggle-same-instance"]').trigger('click');
|
||||
await wrapper
|
||||
.get('[data-testid="toggle-same-instance"]')
|
||||
.trigger('click');
|
||||
|
||||
expect(mocks.configSetString).toHaveBeenCalledWith('VRCX_FriendLocationCardScale', '0.8');
|
||||
expect(mocks.configSetBool).toHaveBeenCalledWith('VRCX_FriendLocationShowSameInstance', true);
|
||||
expect(mocks.configSetString).toHaveBeenCalledWith(
|
||||
'VRCX_FriendLocationCardScale',
|
||||
'0.8'
|
||||
);
|
||||
expect(mocks.configSetBool).toHaveBeenCalledWith(
|
||||
'VRCX_FriendLocationShowSameInstance',
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
test('renders empty state when no rows match', async () => {
|
||||
const wrapper = mount(FriendsLocations);
|
||||
await flushSettings();
|
||||
|
||||
expect(wrapper.get('[data-testid="empty-state"]').text()).toBe('nomatch');
|
||||
expect(wrapper.get('[data-testid="empty-state"]').text()).toBe(
|
||||
'nomatch'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -487,10 +487,18 @@ describe('FriendsLocationsCard.vue', () => {
|
||||
ref: { location: 'wrld_12345:67890~region(us)' }
|
||||
})
|
||||
});
|
||||
const launchInviteItem = getMenuItemByText(wrapper, 'Launch/Invite');
|
||||
const inviteYourselfItem = getMenuItemByText(wrapper, 'Invite Yourself');
|
||||
const launchInviteItem = getMenuItemByText(
|
||||
wrapper,
|
||||
'Launch/Invite'
|
||||
);
|
||||
const inviteYourselfItem = getMenuItemByText(
|
||||
wrapper,
|
||||
'Invite Yourself'
|
||||
);
|
||||
expect(launchInviteItem?.attributes('data-disabled')).toBe('true');
|
||||
expect(inviteYourselfItem?.attributes('data-disabled')).toBe('true');
|
||||
expect(inviteYourselfItem?.attributes('data-disabled')).toBe(
|
||||
'true'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -523,7 +531,10 @@ describe('FriendsLocationsCard.vue', () => {
|
||||
const wrapper = mountCard({
|
||||
friend: makeFriend({ state: 'online' })
|
||||
});
|
||||
const requestInviteItem = getMenuItemByText(wrapper, 'Request Invite');
|
||||
const requestInviteItem = getMenuItemByText(
|
||||
wrapper,
|
||||
'Request Invite'
|
||||
);
|
||||
await requestInviteItem.trigger('click');
|
||||
expect(mockSendRequestInvite).toHaveBeenCalledWith(
|
||||
{ platform: 'standalonewindows' },
|
||||
@@ -560,7 +571,10 @@ describe('FriendsLocationsCard.vue', () => {
|
||||
ref: { location: 'wrld_12345:67890~region(us)' }
|
||||
})
|
||||
});
|
||||
const selfInviteItem = getMenuItemByText(wrapper, 'Invite Yourself');
|
||||
const selfInviteItem = getMenuItemByText(
|
||||
wrapper,
|
||||
'Invite Yourself'
|
||||
);
|
||||
await selfInviteItem.trigger('click');
|
||||
expect(mockSelfInvite).toHaveBeenCalledWith({
|
||||
instanceId: '67890~region(us)',
|
||||
@@ -583,9 +597,9 @@ describe('FriendsLocationsCard.vue', () => {
|
||||
active: false
|
||||
});
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.find('.friend-card__status-dot').classes()).toContain(
|
||||
'friend-card__status-dot--join'
|
||||
);
|
||||
expect(
|
||||
wrapper.find('.friend-card__status-dot').classes()
|
||||
).toContain('friend-card__status-dot--join');
|
||||
});
|
||||
|
||||
test('shows active busy status class when active + busy', () => {
|
||||
@@ -597,9 +611,9 @@ describe('FriendsLocationsCard.vue', () => {
|
||||
const wrapper = mountCard({
|
||||
friend: makeFriend({ status: 'busy' })
|
||||
});
|
||||
expect(wrapper.find('.friend-card__status-dot').classes()).toContain(
|
||||
'friend-card__status-dot--active-busy'
|
||||
);
|
||||
expect(
|
||||
wrapper.find('.friend-card__status-dot').classes()
|
||||
).toContain('friend-card__status-dot--active-busy');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user