Temporal: Fix test to check for TypeError with only one of era/eraYear

These tests were incorrect, in checking for a RangeError when only one of
the era/eraYear fields were given. From CalendarResolveFields:

"The operation throws a *TypeError* exception if the properties of
_fields_ are internally inconsistent within the calendar or insufficient
to identify a unique instance of _type_ in the calendar."
This commit is contained in:
Philip Chimento 2023-09-19 11:06:27 -07:00 committed by Richard Gibson
parent dab8ccc5df
commit f4377a7cf0
2 changed files with 6 additions and 6 deletions

View File

@ -3,17 +3,17 @@
/*---
esid: sec-temporal.calendar.prototype.datefromfields
description: Throw a RangeError if only one of era/eraYear fields is present
description: Throw a TypeError if only one of era/eraYear fields is present
features: [Temporal]
---*/
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
const instance = new Temporal.Calendar('gregory');
assert.throws(RangeError, () => {
assert.throws(TypeError, () => {
instance.dateFromFields({ ...base });
});
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
assert.throws(RangeError, () => {
assert.throws(TypeError, () => {
instance.dateFromFields({ ...base2 });
});

View File

@ -3,17 +3,17 @@
/*---
esid: sec-temporal.calendar.prototype.yearmonthfromfields
description: Throw a RangeError if only one of era/eraYear fields is present
description: Throw a TypeError if only one of era/eraYear fields is present
features: [Temporal]
---*/
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
const instance = new Temporal.Calendar('gregory');
assert.throws(RangeError, () => {
assert.throws(TypeError, () => {
instance.yearMonthFromFields({ ...base });
});
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
assert.throws(RangeError, () => {
assert.throws(TypeError, () => {
instance.yearMonthFromFields({ ...base2 });
});