mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-27 02:33:48 +02:00
use oxfmt instead of prettier
This commit is contained in:
@@ -43,8 +43,14 @@ describe('useSearchAvatar', () => {
|
||||
await api.searchAvatar();
|
||||
|
||||
expect(mocks.lookupAvatars).toHaveBeenCalledWith('search', 'alice');
|
||||
expect(api.searchAvatarResults.value.map((x) => x.id)).toEqual(['avtr_1', 'avtr_2']);
|
||||
expect(api.searchAvatarPage.value.map((x) => x.id)).toEqual(['avtr_1', 'avtr_2']);
|
||||
expect(api.searchAvatarResults.value.map((x) => x.id)).toEqual([
|
||||
'avtr_1',
|
||||
'avtr_2'
|
||||
]);
|
||||
expect(api.searchAvatarPage.value.map((x) => x.id)).toEqual([
|
||||
'avtr_1',
|
||||
'avtr_2'
|
||||
]);
|
||||
expect(api.searchAvatarPageNum.value).toBe(0);
|
||||
});
|
||||
|
||||
@@ -60,7 +66,9 @@ describe('useSearchAvatar', () => {
|
||||
|
||||
it('paginates results by 10 items', () => {
|
||||
const api = useSearchAvatar();
|
||||
api.searchAvatarResults.value = Array.from({ length: 25 }, (_, i) => ({ id: `avtr_${i}` }));
|
||||
api.searchAvatarResults.value = Array.from({ length: 25 }, (_, i) => ({
|
||||
id: `avtr_${i}`
|
||||
}));
|
||||
api.searchAvatarPage.value = api.searchAvatarResults.value.slice(0, 10);
|
||||
|
||||
api.moreSearchAvatar(1);
|
||||
|
||||
@@ -38,7 +38,9 @@ describe('useSearchGroup', () => {
|
||||
it('starts group search with normalized query', async () => {
|
||||
mocks.searchText.value = 'group+name';
|
||||
mocks.replaceBioSymbols.mockReturnValue('group name');
|
||||
mocks.groupSearch.mockResolvedValue({ json: [{ id: 'grp_1' }, { id: 'grp_1' }, { id: 'grp_2' }] });
|
||||
mocks.groupSearch.mockResolvedValue({
|
||||
json: [{ id: 'grp_1' }, { id: 'grp_1' }, { id: 'grp_2' }]
|
||||
});
|
||||
|
||||
const api = useSearchGroup();
|
||||
await api.searchGroup();
|
||||
@@ -49,7 +51,10 @@ describe('useSearchGroup', () => {
|
||||
offset: 0,
|
||||
query: 'group name'
|
||||
});
|
||||
expect(api.searchGroupResults.value.map((x) => x.id)).toEqual(['grp_1', 'grp_2']);
|
||||
expect(api.searchGroupResults.value.map((x) => x.id)).toEqual([
|
||||
'grp_1',
|
||||
'grp_2'
|
||||
]);
|
||||
});
|
||||
|
||||
it('moves backward paging offset without going below zero', async () => {
|
||||
@@ -59,6 +64,10 @@ describe('useSearchGroup', () => {
|
||||
|
||||
await api.moreSearchGroup(-1);
|
||||
|
||||
expect(mocks.groupSearch).toHaveBeenCalledWith({ n: 10, offset: 0, query: 'abc' });
|
||||
expect(mocks.groupSearch).toHaveBeenCalledWith({
|
||||
n: 10,
|
||||
offset: 0,
|
||||
query: 'abc'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,10 +44,19 @@ describe('useSearchUser', () => {
|
||||
|
||||
it('passes page direction into handleMoreSearchUser', async () => {
|
||||
const api = useSearchUser();
|
||||
api.searchUserParams.value = { n: 10, offset: 10, search: 'Alice', customFields: 'displayName', sort: 'relevance' };
|
||||
api.searchUserParams.value = {
|
||||
n: 10,
|
||||
offset: 10,
|
||||
search: 'Alice',
|
||||
customFields: 'displayName',
|
||||
sort: 'relevance'
|
||||
};
|
||||
|
||||
await api.handleMoreSearchUser(-1);
|
||||
|
||||
expect(mocks.moreSearchUser).toHaveBeenCalledWith(-1, api.searchUserParams.value);
|
||||
expect(mocks.moreSearchUser).toHaveBeenCalledWith(
|
||||
-1,
|
||||
api.searchUserParams.value
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,7 +49,9 @@ describe('useSearchWorld', () => {
|
||||
mocks.searchText.value = 'home world';
|
||||
mocks.replaceBioSymbols.mockReturnValue('home world');
|
||||
mocks.cachedWorlds.set('wrld_1', { id: 'wrld_1', name: 'World One' });
|
||||
mocks.getWorlds.mockResolvedValue({ json: [{ id: 'wrld_1' }, { id: 'wrld_missing' }] });
|
||||
mocks.getWorlds.mockResolvedValue({
|
||||
json: [{ id: 'wrld_1' }, { id: 'wrld_missing' }]
|
||||
});
|
||||
|
||||
const api = useSearchWorld();
|
||||
api.searchWorld({});
|
||||
@@ -72,7 +74,14 @@ describe('useSearchWorld', () => {
|
||||
|
||||
it('selects category row and uses row sort settings', async () => {
|
||||
mocks.cachedConfig.value = {
|
||||
dynamicWorldRows: [{ index: 2, sortHeading: 'featured', sortOrder: 'ascending', tag: 'party' }]
|
||||
dynamicWorldRows: [
|
||||
{
|
||||
index: 2,
|
||||
sortHeading: 'featured',
|
||||
sortOrder: 'ascending',
|
||||
tag: 'party'
|
||||
}
|
||||
]
|
||||
};
|
||||
mocks.getWorlds.mockResolvedValue({ json: [] });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user