1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

test-js: Use prettier and format all files

This commit is contained in:
Matthew Olsson 2020-07-05 09:27:00 -07:00 committed by Andreas Kling
parent e532888242
commit 6d58c48c2f
248 changed files with 8291 additions and 7725 deletions

View file

@ -1,53 +1,53 @@
describe("correct behavior", () => {
test("non-object arguments", () => {
expect(Object.preventExtensions()).toBeUndefined();
expect(Object.preventExtensions(undefined)).toBeUndefined();
expect(Object.preventExtensions(null)).toBeNull();
expect(Object.preventExtensions(true)).toBeTrue();
expect(Object.preventExtensions(6)).toBe(6);
expect(Object.preventExtensions("test")).toBe("test");
test("non-object arguments", () => {
expect(Object.preventExtensions()).toBeUndefined();
expect(Object.preventExtensions(undefined)).toBeUndefined();
expect(Object.preventExtensions(null)).toBeNull();
expect(Object.preventExtensions(true)).toBeTrue();
expect(Object.preventExtensions(6)).toBe(6);
expect(Object.preventExtensions("test")).toBe("test");
let s = Symbol();
expect(Object.preventExtensions(s)).toBe(s);
});
let s = Symbol();
expect(Object.preventExtensions(s)).toBe(s);
});
test("basic functionality", () => {
let o = { foo: "foo" };
expect(o.foo).toBe("foo");
o.bar = "bar";
expect(o.bar).toBe("bar");
test("basic functionality", () => {
let o = { foo: "foo" };
expect(o.foo).toBe("foo");
o.bar = "bar";
expect(o.bar).toBe("bar");
expect(Object.preventExtensions(o)).toBe(o);
expect(o.foo).toBe("foo");
expect(o.bar).toBe("bar");
expect(Object.preventExtensions(o)).toBe(o);
expect(o.foo).toBe("foo");
expect(o.bar).toBe("bar");
o.baz = "baz";
expect(o.baz).toBeUndefined();
});
o.baz = "baz";
expect(o.baz).toBeUndefined();
});
});
describe("errors", () => {
test("defining a property on a non-extensible object", () => {
let o = {};
Object.preventExtensions(o);
test("defining a property on a non-extensible object", () => {
let o = {};
Object.preventExtensions(o);
expect(() => {
Object.defineProperty(o, "baz", { value: "baz" });
}).toThrowWithMessage(TypeError, "Cannot define property baz on non-extensible object");
expect(() => {
Object.defineProperty(o, "baz", { value: "baz" });
}).toThrowWithMessage(TypeError, "Cannot define property baz on non-extensible object");
expect(o.baz).toBeUndefined();
});
expect(o.baz).toBeUndefined();
});
test("putting property on a non-extensible object", () => {
let o = {};
Object.preventExtensions(o);
test("putting property on a non-extensible object", () => {
let o = {};
Object.preventExtensions(o);
expect(() => {
"use strict";
o.foo = "foo";
}).toThrowWithMessage(TypeError, "Cannot define property foo on non-extensible object");
expect(() => {
"use strict";
o.foo = "foo";
}).toThrowWithMessage(TypeError, "Cannot define property foo on non-extensible object");
expect(o.foo = "foo").toBe("foo");
expect(o.foo).toBeUndefined();
});
expect((o.foo = "foo")).toBe("foo");
expect(o.foo).toBeUndefined();
});
});