We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 237ea32 commit 6789fe2Copy full SHA for 6789fe2
src/build/__tests__/invariant-test.js
@@ -0,0 +1,10 @@
1
+/* @flow */
2
+
3
+import invariant from '../invariant';
4
5
+describe('invariant()', () => {
6
+ test('works', () => {
7
+ invariant(true, '...');
8
+ expect(() => invariant(false, 'Boom!')).toThrowError('Boom!');
9
+ });
10
+});
src/build/invariant.js
@@ -0,0 +1,7 @@
+export default function invariant(condition: mixed, message: string) {
+ if (!condition) {
+ throw new Error(message);
+ }
+}
0 commit comments