1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:15:07 +00:00

Libraries: Move to Userland/Libraries/

This commit is contained in:
Andreas Kling 2021-01-12 12:17:30 +01:00
parent dc28c07fa5
commit 13d7c09125
1857 changed files with 266 additions and 274 deletions

View file

@ -0,0 +1,32 @@
test("in operator with objects", () => {
const o = { foo: "bar", bar: undefined };
expect("" in o).toBeFalse();
expect("foo" in o).toBeTrue();
expect("bar" in o).toBeTrue();
expect("baz" in o).toBeFalse();
expect("toString" in o).toBeTrue();
});
test("in operator with arrays", () => {
const a = ["hello", "friends"];
expect(0 in a).toBeTrue();
expect(1 in a).toBeTrue();
expect(2 in a).toBeFalse();
expect("0" in a).toBeTrue();
expect("hello" in a).toBeFalse();
expect("friends" in a).toBeFalse();
expect("length" in a).toBeTrue();
});
test("in operator with string object", () => {
const s = new String("foo");
expect("length" in s).toBeTrue();
});
test("error when used with primitives", () => {
["foo", 123, null, undefined].forEach(value => {
expect(() => {
"prop" in value;
}).toThrowWithMessage(TypeError, "'in' operator must be used on an object");
});
});