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 4810cf9 commit 9b49b37Copy full SHA for 9b49b37
To Be Or Not To Be
@@ -0,0 +1,30 @@
1
+/**
2
+ * @param {string} val
3
+ * @return {Object}
4
+ */
5
+
6
+/*
7
+ Example 1:
8
9
+ Input: func = () => expect(5).toBe(5)
10
+ Output: {"value": true}
11
+ Explanation: 5 === 5 so this expression returns true.
12
13
+*/
14
+var expect = function(val) {
15
+ return {
16
+ toBe: (val2) => {
17
+ if (val !== val2) throw new Error("Not Equal");
18
+ else return true;
19
+ },
20
+ notToBe: (val2) => {
21
+ if(val === val2) throw new Error("Equal");
22
23
+ }
24
25
+};
26
27
28
+ * expect(5).toBe(5); // true
29
+ * expect(5).notToBe(5); // throws "Equal"
30
0 commit comments