1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:37:34 +00:00

LibJS: Don't coerce this value to object in Promise.prototype.finally()

This commit is contained in:
Linus Groh 2021-11-14 01:01:08 +00:00
parent 53ec432e8d
commit 194d90dc72
2 changed files with 14 additions and 4 deletions

View file

@ -52,3 +52,11 @@ describe("normal behavior", () => {
expect(thenFinallyArg).not.toBe(catchFinallyArg);
});
});
describe("errors", () => {
test("this value must be an object", () => {
expect(() => {
Promise.prototype.finally.call("foo");
}).toThrowWithMessage(TypeError, "foo is not an object");
});
});