diff --git a/package-lock.json b/package-lock.json index 11b41b50..93e7a62c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -102,7 +102,6 @@ "vkbeautify": "^0.99.3", "xpath": "0.0.34", "xregexp": "^5.1.1", - "yaml": "^2.8.0", "zlibjs": "^0.3.1" }, "devDependencies": { @@ -19249,6 +19248,7 @@ "version": "2.8.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", + "dev": true, "license": "ISC", "bin": { "yaml": "bin.mjs" diff --git a/src/core/operations/YAMLBeautify.mjs b/src/core/operations/YAMLBeautify.mjs index 45714d84..a0ad6098 100644 --- a/src/core/operations/YAMLBeautify.mjs +++ b/src/core/operations/YAMLBeautify.mjs @@ -1,5 +1,5 @@ /** - * @author c.saipraneeth888@gmail.com [c.saipraneeth888@gmail.com] + * @author MrMadFox [c.saipraneeth888@gmail.com] * @copyright Crown Copyright 2025 * @license Apache-2.0 */ diff --git a/tests/operations/tests/YAMLBeautify.mjs b/tests/operations/tests/YAMLBeautify.mjs new file mode 100644 index 00000000..9101bbc7 --- /dev/null +++ b/tests/operations/tests/YAMLBeautify.mjs @@ -0,0 +1,45 @@ +/** + * YamlBeautifier tests. + * + * @author MrMadFox [c.saipraneeth888@gmail.com] + * @copyright Crown Copyright 2018 + * @license Apache-2.0 + */ + +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests( + [{ + name: "YAML Beautify: basic YAML", + input: "key1: value1\nkey2: value2", + expectedOutput: "key1: value1\nkey2: value2\n", + recipeConfig: [{ + "op": "YAML Beautify", + "args": [] + }] + }, { + name: "YAML Beautify: nested YAML", + input: "key1:\n subkey1: value1\n subkey2: value2\nkey2: value3", + expectedOutput: "key1:\n subkey1: value1\n subkey2: value2\nkey2: value3\n", + recipeConfig: [{ + "op": "YAML Beautify", + "args": [] + }] + }, { + name: "YAML Beautify: empty YAML", + input: "", + expectedOutput: "", + recipeConfig: [{ + "op": "YAML Beautify", + "args": [] + }] + }, { + name: "YAML Beautify: malformed YAML", + input: "key1: value1\nkey2: value2\nkey3", + expectedOutput: "key1: value", + recipeConfig: [{ + "op": "YAML Beautify", + "args": [] + }] + } + ]);