stringzy
Version:
A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.
23 lines (22 loc) • 1.07 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 wordCount_1 = require("../../analyzing/wordCount");
(0, node_test_1.describe)('wordCount', () => {
(0, node_test_1.it)('counts words in a string', () => {
node_assert_1.default.strictEqual((0, wordCount_1.wordCount)('hello world'), 2);
});
(0, node_test_1.it)('returns 0 for empty string', () => {
node_assert_1.default.strictEqual((0, wordCount_1.wordCount)(''), 0);
});
(0, node_test_1.it)('returns 0 for whitespace string', () => {
node_assert_1.default.strictEqual((0, wordCount_1.wordCount)(' '), 0);
});
(0, node_test_1.it)('throws if input is not a string', () => {
node_assert_1.default.throws(() => (0, wordCount_1.wordCount)(123), /Input must be a string/);
});
});
;