Skip to content

Commit 1e8685b

Browse files
committed
add another test
1 parent 6d32545 commit 1e8685b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Sprint-2/interpret/invert.test.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ const invert = require("./invert.js");
22
// Given an object
33
// When invert is passed this object
44
// Then it should swap the keys and values in the object
5+
describe("invert()", () => {
6+
describe("invert function", () => {
7+
test("should swap the keys and values in the object", () => {
8+
expect(invert({ a: 1 })).toEqual({ 1: "a" });
9+
expect(invert({ x: 10, y: 20 })).toEqual({ 10: "x", 20: "y" });
10+
});
11+
});
512

6-
describe("invert function", () => {
7-
test("should swap the keys and values in the object", () => {
8-
expect(invert({ a: 1 })).toEqual({ 1: "a" });
13+
describe("given an empty object is passed into the function", () => {
14+
test("should return and empty object", () => {
15+
expect(invert({})).toEqual({});
16+
});
917
});
1018
});

0 commit comments

Comments
 (0)