UNPKG

stringzy

Version:

A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.

23 lines (22 loc) 1.09 kB
"use strict"; 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 toSlug_1 = require("../../transformations/toSlug"); (0, node_test_1.describe)('toSlug', () => { (0, node_test_1.it)('converts text to slug', () => { node_assert_1.default.strictEqual((0, toSlug_1.toSlug)('Hello World!'), 'hello-world'); }); (0, node_test_1.it)('handles already slugged text', () => { node_assert_1.default.strictEqual((0, toSlug_1.toSlug)('already-slugged'), 'already-slugged'); }); (0, node_test_1.it)('removes special characters', () => { node_assert_1.default.strictEqual((0, toSlug_1.toSlug)('foo@bar#baz'), 'foobarbaz'); }); (0, node_test_1.it)('throws if input is not a string', () => { node_assert_1.default.throws(() => (0, toSlug_1.toSlug)(123), /Invalid argument/); }); });