mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-21 16:00:59 -05:00
Added tests for action-parameter
This commit is contained in:
parent
fbd229daea
commit
ac7140da00
1 changed files with 30 additions and 0 deletions
30
tests/unit/utils/actions/action-parameter.spec.ts
Normal file
30
tests/unit/utils/actions/action-parameter.spec.ts
Normal file
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue