mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:27:45 +00:00
LibJS: Implement Temporal.Duration.prototype.sign
This commit is contained in:
parent
be5254dcac
commit
3713164fa3
3 changed files with 32 additions and 0 deletions
|
@ -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");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue