From 43c202b562b045b3588ae519dde9c1aae0e34851 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Sun, 2 Oct 2022 08:22:49 +0100 Subject: [PATCH] fix: added getFileContents tests with and without file --- source/platforms/gitlab/_tests/_gitlab_api.test.ts | 5 +++++ .../platforms/gitlab/_tests/fixtures/getFileContents.json | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/source/platforms/gitlab/_tests/_gitlab_api.test.ts b/source/platforms/gitlab/_tests/_gitlab_api.test.ts index 687e103cc..5f6cd4011 100644 --- a/source/platforms/gitlab/_tests/_gitlab_api.test.ts +++ b/source/platforms/gitlab/_tests/_gitlab_api.test.ts @@ -175,6 +175,11 @@ describe("GitLab API", () => { ref: "master", expected: "source 'https://rubygems.org'", }, + { + filePath: "FileNotExist", + ref: "master", + expected: "", + }, ] for (let el in parameters) { let result = await api.getFileContents(parameters[el].filePath, api.repoMetadata.repoSlug, parameters[el].ref) diff --git a/source/platforms/gitlab/_tests/fixtures/getFileContents.json b/source/platforms/gitlab/_tests/fixtures/getFileContents.json index b3b327689..b5359893e 100644 --- a/source/platforms/gitlab/_tests/fixtures/getFileContents.json +++ b/source/platforms/gitlab/_tests/fixtures/getFileContents.json @@ -18,5 +18,13 @@ "execute_filemode": false, "content": "c291cmNlICdodHRwczovL3J1YnlnZW1zLm9yZycK" } + }, + { + "scope": "https://gitlab.com", + "method": "GET", + "path": "/api/v4/projects/gitlab-org%2Fgitlab-foss/repository/files/FileNotExist?ref=master", + "body": "", + "status": 404, + "response": {} } ]