UNPKG

predictype

Version:

PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.

28 lines (27 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const stringSubstring_js_1 = require("./stringSubstring.js"); (0, vitest_1.describe)('stringSubstring', () => { (0, vitest_1.it)('should return true for includes', () => { const str = 'foobar'; (0, vitest_1.expect)((0, stringSubstring_js_1.stringSubstring)(str, 'includes', 'foo')).toBe(true); }); (0, vitest_1.it)('should return true for excludes', () => { const str = 'foobar'; (0, vitest_1.expect)((0, stringSubstring_js_1.stringSubstring)(str, 'excludes', 'baz')).toBe(true); }); (0, vitest_1.it)('should return true for starts_with', () => { const str = 'foobar'; (0, vitest_1.expect)((0, stringSubstring_js_1.stringSubstring)(str, 'starts_with', 'foo')).toBe(true); }); (0, vitest_1.it)('should return true for ends_with', () => { const str = 'foobar'; (0, vitest_1.expect)((0, stringSubstring_js_1.stringSubstring)(str, 'ends_with', 'bar')).toBe(true); }); (0, vitest_1.it)('should throw for unknown operator', () => { const str = 'foobar'; // @ts-expect-error (0, vitest_1.expect)(() => (0, stringSubstring_js_1.stringSubstring)(str, 'invalid_operator', 'foo')).toThrow('Unknown StringSubstring operation: invalid_operator'); }); });