From bbcc4c497181462a2e681711b08105c5cdf5c2a3 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 9 Jan 2024 11:05:44 +0000 Subject: [PATCH] Added tests for `platform-uploader` --- .../unit/platforms/platform-uploader.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/unit/platforms/platform-uploader.spec.ts diff --git a/tests/unit/platforms/platform-uploader.spec.ts b/tests/unit/platforms/platform-uploader.spec.ts new file mode 100644 index 0000000..89506f2 --- /dev/null +++ b/tests/unit/platforms/platform-uploader.spec.ts @@ -0,0 +1,19 @@ +import { GitHubContext } from "@/platforms/github/github-context"; +import { PlatformType } from "@/platforms/platform-type"; +import { createPlatformUploader } from "@/platforms/platform-uploader"; + +describe("createPlatformUploader", () => { + test("creates an uploader for every known platform", () => { + const options = { + githubContext: { repo: "" } as unknown as GitHubContext, + }; + + for (const platform of PlatformType.values()) { + expect(createPlatformUploader(platform, options)).toBeDefined(); + } + }); + + test("throws an error when an unknown platform is provided", () => { + expect(() => createPlatformUploader("unknown" as PlatformType, { githubContext: null })).toThrow("Unknown platform 'unknown'."); + }); +});