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

LibJS: Implement Temporal.Duration.prototype.sign

This commit is contained in:
Linus Groh 2021-07-16 00:12:03 +01:00
parent be5254dcac
commit 3713164fa3
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,17 @@
describe("correct behavior", () => {
test("basic functionality", () => {
const positiveDuration = new Temporal.Duration(123);
expect(positiveDuration.sign).toBe(1);
const negativeDuration = new Temporal.Duration(-123);
expect(negativeDuration.sign).toBe(-1);
});
});
test("errors", () => {
test("this value must be a Temporal.Duration object", () => {
expect(() => {
Reflect.get(Temporal.Duration.prototype, "sign", "foo");
}).toThrowWithMessage(TypeError, "Not a Temporal.Duration");
});
});