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.26 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const stringState_js_1 = require("./stringState.js");
(0, vitest_1.describe)('stringState', () => {
(0, vitest_1.it)('should return true for is_empty', () => {
const str = '';
(0, vitest_1.expect)((0, stringState_js_1.stringState)(str, 'is_empty')).toBe(true);
});
(0, vitest_1.it)('should return true for is_not_empty', () => {
const str = 'foo';
(0, vitest_1.expect)((0, stringState_js_1.stringState)(str, 'is_not_empty')).toBe(true);
});
(0, vitest_1.it)('should return true for is_blank', () => {
const str2 = ' ';
(0, vitest_1.expect)((0, stringState_js_1.stringState)(str2, 'is_blank')).toBe(true);
});
(0, vitest_1.it)('should return true for is_not_blank', () => {
const str = 'foo';
(0, vitest_1.expect)((0, stringState_js_1.stringState)(str, 'is_not_blank')).toBe(true);
});
(0, vitest_1.it)('throws on unknown operation', () => {
const str = 'foo';
// @ts-expect-error
(0, vitest_1.expect)(() => (0, stringState_js_1.stringState)(str, 'invalid')).toThrow('Unknown StringState operation: invalid');
});
});
;