From 59f9d7176a33e65212695ba5a20c798c093a2f0d Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 18 Sep 2021 00:58:51 +0200 Subject: [PATCH] git-release-manager: fix test Signed-off-by: Patrik Oldsberg --- .../src/hooks/useGetGitBatchInfo.test.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts index b94dddf8f7..fb1a8b6919 100644 --- a/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts +++ b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts @@ -70,7 +70,9 @@ describe('useGetHubBatchInfo', () => { }); it('should handle repositories without any releases', async () => { - (mockApiClient.getLatestRelease as jest.Mock).mockResolvedValueOnce(null); + (mockApiClient.getLatestRelease as jest.Mock).mockResolvedValueOnce({ + latestRelease: null, + }); const { result } = renderHook(() => useGetGitBatchInfo({ @@ -85,8 +87,16 @@ describe('useGetHubBatchInfo', () => { expect(result.current.gitBatchInfo).toMatchInlineSnapshot(` Object { - "error": [TypeError: Cannot read property 'latestRelease' of null], "loading": false, + "value": Object { + "latestRelease": null, + "releaseBranch": null, + "repository": Object { + "defaultBranch": "mock_defaultBranch", + "name": "mock_repo", + "pushPermissions": true, + }, + }, } `); });