diff --git a/app/src/api/dataAccess/__mocks__/editHistory.ts b/app/src/api/dataAccess/__mocks__/editHistory.ts index ad84e63b..2e069301 100644 --- a/app/src/api/dataAccess/__mocks__/editHistory.ts +++ b/app/src/api/dataAccess/__mocks__/editHistory.ts @@ -9,14 +9,13 @@ const mockEditHistory = let mockData: EditHistoryEntry[] = []; mockEditHistory.__setHistory = function(mockHistoryData: EditHistoryEntry[]) { - mockData = mockHistoryData; + mockData = mockHistoryData.sort(numDesc(x => BigInt(x.revision_id))); }; mockEditHistory.getHistoryAfterId = function(id: string, count: number): Promise { return Promise.resolve( mockData .filter(x => BigInt(x.revision_id) > BigInt(id)) - .sort(numDesc(x => BigInt(x.revision_id))) .slice(0, count) ); }; @@ -25,16 +24,15 @@ mockEditHistory.getHistoryBeforeId = function(id: string, count: number): Promis return Promise.resolve( mockData .filter(x => BigInt(x.revision_id) < BigInt(id)) - .sort(numDesc(x => BigInt(x.revision_id))) .slice(0, count) ); }; mockEditHistory.getLatestHistory = function(count: number): Promise { + return Promise.resolve( mockData - .slice(mockData.length - count, mockData.length) - .sort(numDesc(x => BigInt(x.revision_id))) + .slice(0, count) ); };