Oliver Mitchell 861313e493 feat: Add string insertion operators Append, Prepend, and Insert At
- Added Append operator to insert text at the end of the input
- Added Prepend operator to insert text at the start of the input
- Added Insert At operator to insert text at a given index within the input
- Added tests for all new operations.
2026-05-06 02:53:23 +09:30

43 lines
1.1 KiB
JavaScript

/**
* Media operation tests.
* @author oliver-mitchell [oliver@polymerlabs.dev]
* @copyright Crown Copyright 2026
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Append empty",
input: "test",
expectedOutput: "test",
recipeConfig: [
{ op: "Append", args: ["", "None"] } // [text, delimiter]
]
},
{
name: "Append empty input",
input: "",
expectedOutput: "test",
recipeConfig: [
{ op: "Append", args: ["test", "None"] } // [text, delimiter]
]
},
{
name: "Append with input and text",
input: "hello ",
expectedOutput: "hello world",
recipeConfig: [
{ op: "Append", args: ["world", "None"] } // [text, delimiter]
]
},
{
name: "Append with space delim",
input: "hello world",
expectedOutput: "hello: world:",
recipeConfig: [
{ op: "Append", args: [":", "Space"] } // [text, delimiter]
]
}
]);