mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
This matches our coding style recommendation in CodingStyle.md, and matches our python formatting.
31 lines
1005 B
JavaScript
31 lines
1005 B
JavaScript
test("constructor properties", () => {
|
|
expect(FinalizationRegistry).toHaveLength(1);
|
|
expect(FinalizationRegistry.name).toBe("FinalizationRegistry");
|
|
});
|
|
|
|
describe("errors", () => {
|
|
test("invalid callbacks", () => {
|
|
[-100, Infinity, NaN, 152n, undefined].forEach(value => {
|
|
expect(() => {
|
|
new FinalizationRegistry(value);
|
|
}).toThrowWithMessage(TypeError, "is not a function");
|
|
});
|
|
});
|
|
test("called without new", () => {
|
|
expect(() => {
|
|
FinalizationRegistry();
|
|
}).toThrowWithMessage(TypeError, "FinalizationRegistry constructor must be called with 'new'");
|
|
});
|
|
});
|
|
|
|
describe("normal behavior", () => {
|
|
test("typeof", () => {
|
|
expect(typeof new FinalizationRegistry(() => {})).toBe("object");
|
|
});
|
|
|
|
test("constructor with single callback argument", () => {
|
|
var a = new FinalizationRegistry(() => {});
|
|
expect(a instanceof FinalizationRegistry).toBeTrue();
|
|
});
|
|
});
|