Skip to content

Commit

Permalink
Temporal: Add a test for PlainTime#toZonedDateTime.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger authored and ptomato committed May 19, 2022
1 parent a1a5c91 commit 7960d61
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaintime.tozoneddatetime
description: Both plainDate and timeZone properties need to not be undefined.
features: [Temporal]
---*/

const instance = new Temporal.PlainTime();
const plainDate = new Temporal.PlainDate(2022, 5, 19);
const timeZone = new Temporal.TimeZone("UTC");
assert.throws(TypeError, () => instance.toZonedDateTime({}),
"no properties");
assert.throws(TypeError, () => instance.toZonedDateTime({ plainDate }),
"only plainDate");
assert.throws(TypeError, () => instance.toZonedDateTime({ plainDate, timeZone: undefined }),
"timeZone explicitly undefined");
assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone }),
"only timeZone");
assert.throws(TypeError, () => instance.toZonedDateTime({ plainDate: undefined, timeZone }),
"plainDate explicitly undefined");

0 comments on commit 7960d61

Please sign in to comment.