From 4b7f8b49cc07a89c093475f284ef112f26a8529f Mon Sep 17 00:00:00 2001 From: Sarah GHP Date: Tue, 16 Nov 2021 20:43:07 +0100 Subject: [PATCH] Adds invalid constuction options --- .../prototype/since/options-invalid.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js new file mode 100644 index 0000000000..24e59e3b3b --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: Verify that invalid options are handled correctly. +features: [Temporal] +---*/ + +const feb20 = new Temporal.PlainYearMonth(2020, 2); +const feb21 = new Temporal.PlainYearMonth(2021, 2); + +[ + null, + 1, + 'hello', + true, + Symbol('foo'), + 1n +].forEach((badOption) => + assert.throws(TypeError, () => feb21.since(feb20, badOption), `${String(badOption)} throws TypeError`) +);