We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ef06e75 + 45f8b79 commit 2cb1d3eCopy full SHA for 2cb1d3e
src/util/assert.js
@@ -1,2 +1,5 @@
1
-const { assert } = console;
2
-export default assert;
+export default (condition, message) => {
+ if (!condition) {
3
+ throw new Error(message);
4
+ }
5
+};
test/util/assert.spec.js
@@ -0,0 +1,8 @@
+import { expect } from 'chai';
+import assert from '../../src/util/assert.js';
+
+describe('Testing assert.js', () => {
+ it('Testing throw', () => {
6
+ expect(() => assert(false, 'message')).to.throw('message');
7
+ });
8
+});
0 commit comments