stringzy
Version:
A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.
23 lines (22 loc) • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_test_1 = require("node:test");
const node_assert_1 = __importDefault(require("node:assert"));
const removeSpecialChars_1 = require("../../transformations/removeSpecialChars");
(0, node_test_1.describe)('removeSpecialChars', () => {
(0, node_test_1.it)('removes special characters', () => {
node_assert_1.default.strictEqual((0, removeSpecialChars_1.removeSpecialChars)('hello@world!'), 'helloworld');
});
(0, node_test_1.it)('replaces special characters with custom string', () => {
node_assert_1.default.strictEqual((0, removeSpecialChars_1.removeSpecialChars)('hello@world!', '-'), 'hello-world-');
});
(0, node_test_1.it)('throws if input is not a string', () => {
node_assert_1.default.throws(() => (0, removeSpecialChars_1.removeSpecialChars)(123), /Invalid argument/);
});
(0, node_test_1.it)('throws if replacement is not a string', () => {
node_assert_1.default.throws(() => (0, removeSpecialChars_1.removeSpecialChars)('abc', 123), /Replacement must be a string/);
});
});