Skip to content

Commit

Permalink
Fix pagination test
Browse files Browse the repository at this point in the history
  • Loading branch information
madirey committed Jul 28, 2020
1 parent b19afd5 commit 50f8be1
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,23 @@ describe('buildEventTypeSignal', () => {
test('it should convert the exception lists response to the proper endpoint format while paging', async () => {
// The first call returns two exceptions
const first = getFoundExceptionListItemSchemaMock();
first.per_page = 2;
first.total = 4;
first.data.push(getExceptionListItemSchemaMock());

// The second call returns two exceptions
const second = getFoundExceptionListItemSchemaMock();
second.per_page = 2;
second.total = 4;
second.data.push(getExceptionListItemSchemaMock());

// The third call returns no exceptions, paging stops
const third = getFoundExceptionListItemSchemaMock();
third.data = [];
mockExceptionClient.findExceptionListItem = jest
.fn()
.mockReturnValueOnce(first)
.mockReturnValueOnce(second)
.mockReturnValueOnce(third);
.mockReturnValueOnce(second);

const resp = await getFullEndpointExceptionList(mockExceptionClient, 'linux', 'v1');

// Expect 2 exceptions, the first two calls returned the same exception list items
expect(resp.entries.length).toEqual(2);
});
Expand Down

0 comments on commit 50f8be1

Please sign in to comment.