summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2022-02-10 11:33:05 +0100
committerLinus Groh <mail@linusgroh.de>2022-02-10 14:09:39 +0000
commit821ae3a4798b01eeca44304b4145f899011d1c1b (patch)
tree818567e6a65ec792595f26d17010073915704c33 /Userland/Libraries/LibJS
parent45646eee43b147c222bf66816989f32113221a94 (diff)
downloadserenity-821ae3a4798b01eeca44304b4145f899011d1c1b.zip
LibJS: Add tests for Set.prototype.keys which is an alias for values
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.values.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.values.js b/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.values.js
index 2b6a0db262..3dc85cde02 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.values.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.values.js
@@ -12,3 +12,20 @@ test("basic functionality", () => {
expect(it.next()).toEqual({ value: undefined, done: true });
expect(it.next()).toEqual({ value: undefined, done: true });
});
+
+describe("keys is an alias for values", () => {
+ test("length", () => {
+ expect(Set.prototype.keys.length).toBe(0);
+ });
+
+ test("basic functionality", () => {
+ const a = new Set([1, 2, 3]);
+ const it = a.keys();
+ expect(it.next()).toEqual({ value: 1, done: false });
+ expect(it.next()).toEqual({ value: 2, done: false });
+ expect(it.next()).toEqual({ value: 3, done: false });
+ expect(it.next()).toEqual({ value: undefined, done: true });
+ expect(it.next()).toEqual({ value: undefined, done: true });
+ expect(it.next()).toEqual({ value: undefined, done: true });
+ });
+});