From 54261296bb66a64f80c42f4e986c9ddd4ea8ecee Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Tue, 24 Jan 2023 13:29:23 -0500 Subject: [PATCH] Add tests for errors when fetching actions --- .../action-input.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/actions-languageserver/src/description-providers/action-input.test.ts b/actions-languageserver/src/description-providers/action-input.test.ts index b6938e6..adac8b8 100644 --- a/actions-languageserver/src/description-providers/action-input.test.ts +++ b/actions-languageserver/src/description-providers/action-input.test.ts @@ -110,4 +110,23 @@ describe("action descriptions", () => { expect(await getDescription("typo", mock)).toBeUndefined(); }); + + // TODO: https://github.com/github/c2c-actions-experience/issues/7056 + it.failing("action does not exist", async () => { + const mock = fetchMock + .sandbox() + .getOnce("https://api.github.com/repos/actions/checkout/contents/action.yml?ref=v3", 404) + .getOnce("https://api.github.com/repos/actions/checkout/contents/action.yaml?ref=v3", 404); + + expect(await getDescription("repository", mock)).toBeUndefined(); + }); + + // TODO: https://github.com/github/c2c-actions-experience/issues/7056 + it.failing("invalid permissions", async () => { + const mock = fetchMock + .sandbox() + .getOnce("https://api.github.com/repos/actions/checkout/contents/action.yml?ref=v3", 403); + + expect(await getDescription("repository", mock)).toBeUndefined(); + }); });