From 82da9ceeebe5833f62071d657de4ce34bf32fb03 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Mon, 13 Mar 2023 10:07:23 -0400 Subject: [PATCH] Fix mock in tests --- app/soapbox/api/__mocks__/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/api/__mocks__/index.ts b/app/soapbox/api/__mocks__/index.ts index 92175d076..d0931a397 100644 --- a/app/soapbox/api/__mocks__/index.ts +++ b/app/soapbox/api/__mocks__/index.ts @@ -23,7 +23,12 @@ export const getLinks = (response: AxiosResponse): LinkHeader => { export const getNextLink = (response: AxiosResponse) => { const nextLink = new LinkHeader(response.headers?.link); - return nextLink.refs.find((ref) => ref.uri)?.uri; + return nextLink.refs.find(link => link.rel === 'next')?.uri; +}; + +export const getPrevLink = (response: AxiosResponse) => { + const prevLink = new LinkHeader(response.headers?.link); + return prevLink.refs.find(link => link.rel === 'prev')?.uri; }; export const baseClient = (...params: any[]) => {