predictype
Version:
PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.
32 lines (31 loc) • 1.55 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const bigintState_js_1 = require("./bigintState.js");
(0, vitest_1.describe)('bigintState', () => {
(0, vitest_1.it)('should return true for is_zero', () => {
const value = BigInt(0);
(0, vitest_1.expect)((0, bigintState_js_1.bigintState)(value, 'is_zero')).toBe(true);
});
(0, vitest_1.it)('should return true for is_positive', () => {
const value = BigInt(10);
(0, vitest_1.expect)((0, bigintState_js_1.bigintState)(value, 'is_positive')).toBe(true);
});
(0, vitest_1.it)('should return true for is_negative', () => {
const value = BigInt(-5);
(0, vitest_1.expect)((0, bigintState_js_1.bigintState)(value, 'is_negative')).toBe(true);
});
(0, vitest_1.it)('should return true for is_even', () => {
const value = BigInt(8);
(0, vitest_1.expect)((0, bigintState_js_1.bigintState)(value, 'is_even')).toBe(true);
});
(0, vitest_1.it)('should return true for is_odd', () => {
const value = BigInt(7);
(0, vitest_1.expect)((0, bigintState_js_1.bigintState)(value, 'is_odd')).toBe(true);
});
(0, vitest_1.it)('should throw for unknown operator', () => {
const value = BigInt(1);
// @ts-expect-error: purposely passing an invalid operator
(0, vitest_1.expect)(() => (0, bigintState_js_1.bigintState)(value, 'invalid_operator')).toThrow('Unknown BigIntState operation: invalid_operator');
});
});
;