There was an error while loading. Please reload this page.
1 parent 4c91d5d commit c1f577bCopy full SHA for c1f577b
1 file changed
Sprint-2/interpret/invert.test.js
@@ -0,0 +1,18 @@
1
+const invert = require("./invert.js");
2
+
3
+test("should swap keys and values in an object", () => {
4
+ expect(invert({ a: 1, b: 2 })).toEqual({
5
+ 1: "a",
6
+ 2: "b",
7
+ });
8
+});
9
10
+test("should invert an object with a single key-value pair", () => {
11
+ expect(invert({ x: 10 })).toEqual({
12
+ 10: "x",
13
14
15
16
+test("should return an empty object when passed an empty object", () => {
17
+ expect(invert({})).toEqual({});
18
0 commit comments