predictype
Version:
PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.
23 lines (22 loc) • 1.03 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const stringMembership_js_1 = require("./stringMembership.js");
(0, vitest_1.describe)('stringMembership', () => {
(0, vitest_1.it)('should return true for in', () => {
const arr = ['foo', 'bar'];
const value1 = 'foo';
(0, vitest_1.expect)((0, stringMembership_js_1.stringMembership)(value1, 'in', arr)).toBe(true);
});
(0, vitest_1.it)('should return true for not_in', () => {
const arr = ['foo', 'bar'];
const value2 = 'baz';
(0, vitest_1.expect)((0, stringMembership_js_1.stringMembership)(value2, 'not_in', arr)).toBe(true);
});
(0, vitest_1.it)('throws on unknown operation', () => {
const arr = ['foo', 'bar'];
const value = 'foo';
// @ts-expect-error
(0, vitest_1.expect)(() => (0, stringMembership_js_1.stringMembership)(value, 'invalid', arr)).toThrow('Unknown StringMembership operation: invalid');
});
});
;