30 lines
627 B
TypeScript
30 lines
627 B
TypeScript
import { cleanInput } from "./repl.js";
|
|
import { describe, expect, test } from "vitest";
|
|
|
|
describe.each([
|
|
{
|
|
input: " ",
|
|
expected: [],
|
|
},
|
|
{
|
|
input: " hello ",
|
|
expected: ["hello"],
|
|
},
|
|
{
|
|
input: " hello world ",
|
|
expected: ["hello", "world"],
|
|
},
|
|
{
|
|
input: " HellO World ",
|
|
expected: ["hello", "world"],
|
|
},
|
|
])("cleanInput($input)", ({ input, expected }) => {
|
|
test(`Expected: ${expected}`, () => {
|
|
const actual = cleanInput(input);
|
|
expect(actual).toHaveLength(expected.length);
|
|
for (const i in expected) {
|
|
expect(actual[i]).toBe(expected[i]);
|
|
}
|
|
});
|
|
});
|