Skip to content

Commit

Permalink
add another unit test for exo 6
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpolletvillard committed Oct 1, 2024
1 parent 01b8eb9 commit a9a1fab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions __tests__/exo06.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,41 @@ const d = parseUserData({
company: null
});

const e = parseUserData({
name: undefined,
age: "old",
rightId: "",
company: "Oracle"
})

it("should parse name correctly", () => {
expect(a.name).toBe("Luke");
expect(b.name).toBe("Anonymous");
expect(c.name).toBe("Anonymous");
expect(d.name).toBe("Anonymous");
expect(e.name).toBe("Anonymous");
});

it("should parse age correctly", () => {
expect(a.age).toBe(28);
expect(b.age).toBe(0);
expect(c.age).toBe(12);
expect(d.age).toBe(0);
expect(e.age).toBe(0);
});

it("should parse isAdmin correctly", () => {
expect(a.isAdmin).toBe(true);
expect(b.isAdmin).toBe(false);
expect(c.isAdmin).toBe(false);
expect(d.isAdmin).toBe(false);
expect(e.isAdmin).toBe(false);
});

it("should parse company correctly", () => {
expect(a.company).toBe("Microsoft");
expect(b.company).toBe(false);
expect(c.company).toBe(false);
expect(d.company).toBe(false);
expect(e.company).toBe(false);
});

0 comments on commit a9a1fab

Please sign in to comment.