invariant

说明

自定义的异常处理机制(用于本仓库使用)

源码

用法

invariant.test.ts
1
import { invariant } from "../../utility/others/invariant";
2
3
describe('invariant', () => {
4
5
// ! Test successed
6
// test('invariant should throw error when the condition to be true', () => {
7
// expect(utilityOthers.invariant(true, 'test error')).toThrowErrorMatchingSnapshot();
8
// });
9
10
test('invariant should not do anything when the condition to be false', () => {
11
expect(invariant(false, 'test error')).toBeFalsy();
12
});
13
});
Copied!
最近更新 1yr ago
复制链接