1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

LibJS: Add tests for Set.prototype.keys which is an alias for values

This commit is contained in:
davidot 2022-02-10 11:33:05 +01:00 committed by Linus Groh
parent 45646eee43
commit 821ae3a479

View file

@ -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 });
});
});