From 22afcaf21546ffa4d1c58ad66c22308677428544 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann <christian@bagerbach.com> Date: Tue, 8 Nov 2022 17:03:27 +0100 Subject: [PATCH] add test for url extension func --- src/utility/getUrlExtension.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/utility/getUrlExtension.test.ts diff --git a/src/utility/getUrlExtension.test.ts b/src/utility/getUrlExtension.test.ts new file mode 100644 index 0000000..2c9028d --- /dev/null +++ b/src/utility/getUrlExtension.test.ts @@ -0,0 +1,12 @@ +import { describe, test, expect } from "vitest"; +import getUrlExtension from "./getUrlExtension"; + +describe("getUrlExtension", () => { + test("should return the extension of a url", () => { + expect(getUrlExtension("https://example.com/file.mp3")).toBe("mp3"); + }); + + test("should return the extension of a url with params", () => { + expect(getUrlExtension("https://example.com/file.mp3?key=value&key2=.mpegvalue")).toBe("mp3"); + }); +}); -- GitLab