Skip to content

Commit 4078d42

Browse files
committed
Add tests for Enum.{keys, values}
1 parent 70a9382 commit 4078d42

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

__tests__/test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,23 @@ describe("Enum", () => {
1616
})).toEqual({ BLACK: "black", WHITE: "white" });
1717
});
1818
});
19+
20+
describe("Enum.keys", () => {
21+
it("returns the keys of an enum object", () => {
22+
const e = Enum({
23+
BLACK: "black",
24+
WHITE: "white",
25+
});
26+
expect(Enum.keys(e)).toEqual(expect.arrayContaining([ "WHITE", "BLACK" ]));
27+
});
28+
};
29+
30+
describe("Enum.values", () => {
31+
it("returns the values of an enum object", () => {
32+
const e = Enum({
33+
BLACK: "black",
34+
WHITE: "white",
35+
});
36+
expect(Enum.values(e)).toEqual(expect.arrayContaining([ "white", "black" ]));
37+
});
38+
});

0 commit comments

Comments
 (0)