From ac7140da009a638803926b4b83a10cb780dfb7ed Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Wed, 10 Jan 2024 15:06:22 +0000 Subject: [PATCH] Added tests for `action-parameter` --- .../utils/actions/action-parameter.spec.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/unit/utils/actions/action-parameter.spec.ts diff --git a/tests/unit/utils/actions/action-parameter.spec.ts b/tests/unit/utils/actions/action-parameter.spec.ts new file mode 100644 index 0000000..1ba9848 --- /dev/null +++ b/tests/unit/utils/actions/action-parameter.spec.ts @@ -0,0 +1,30 @@ +import { normalizeActionParameterName } from "@/utils/actions/action-parameter"; + +describe("normalizeActionParameterName", () => { + test("converts parameter name to uppercase and replaces spaces with underscores", () => { + const name = "test parameter"; + const expected = "TEST_PARAMETER"; + + const result = normalizeActionParameterName(name); + + expect(result).toBe(expected); + }); + + test("returns the same string if it's already uppercase and does not contain spaces", () => { + const name = "TEST_PARAMETER"; + const expected = "TEST_PARAMETER"; + + const result = normalizeActionParameterName(name); + + expect(result).toBe(expected); + }); + + test("returns an empty string if the input is an empty string", () => { + const name = ""; + const expected = ""; + + const result = normalizeActionParameterName(name); + + expect(result).toBe(expected); + }); +});