Skip to content

Commit b805a74

Browse files
committed
refactor: loads new pages on scroll test
1 parent c7996df commit b805a74

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

src/Autocomplete/assets/test/controller.test.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,20 @@ describe('AutocompleteController', () => {
345345
fetchMock.mock(
346346
'/path/to/autocomplete?query=',
347347
JSON.stringify({
348-
results: [
349-
{value: 1, text: 'dog1'},
350-
{value: 2, text: 'dog2'},
351-
{value: 3, text: 'dog3'},
352-
{value: 4, text: 'dog4'},
353-
{value: 5, text: 'dog5'},
354-
{value: 6, text: 'dog6'},
355-
{value: 7, text: 'dog7'},
356-
{value: 8, text: 'dog8'},
357-
{value: 9, text: 'dog9'},
358-
{value: 10, text: 'dog10'},
359-
],
348+
results: {
349+
options : [
350+
{value: 1, text: 'dog1'},
351+
{value: 2, text: 'dog2'},
352+
{value: 3, text: 'dog3'},
353+
{value: 4, text: 'dog4'},
354+
{value: 5, text: 'dog5'},
355+
{value: 6, text: 'dog6'},
356+
{value: 7, text: 'dog7'},
357+
{value: 8, text: 'dog8'},
358+
{value: 9, text: 'dog9'},
359+
{value: 10, text: 'dog10'},
360+
]
361+
},
360362
next_page: '/path/to/autocomplete?query=&page=2'
361363
}),
362364
);
@@ -377,11 +379,13 @@ describe('AutocompleteController', () => {
377379
fetchMock.mock(
378380
'/path/to/autocomplete?query=&page=2',
379381
JSON.stringify({
380-
results: [
381-
{value: 11, text: 'dog11'},
382-
{value: 12, text: 'dog12'},
383-
],
384-
next_page: null,
382+
results: {
383+
options: [
384+
{value: 11, text: 'dog11'},
385+
{value: 12, text: 'dog12'},
386+
],
387+
next_page: null,
388+
}
385389
}),
386390
);
387391

0 commit comments

Comments
 (0)