-
Notifications
You must be signed in to change notification settings - Fork 520
[Temporal] Remove test/staging/Temporal/v8/calendar-date-from-fields.js #4816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Temporal] Remove test/staging/Temporal/v8/calendar-date-from-fields.js #4816
Conversation
And move functionality into existing tests.
|
|
||
| for (const [arg, description] of primitiveTests) { | ||
| assert.throws( | ||
| typeof arg === 'string' ? RangeError : TypeError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the empty string in test/built-ins/Temporal/Duration/from/argument-string-invalid.js (this file is called argument-non-string.js!), and then I don't think there's a reason to have two separate arrays and loops.
|
|
||
| for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) { | ||
| assert.throws( | ||
| typeof arg === 'string' || (typeof arg === 'object' && arg !== null) || typeof arg === 'function' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is where that came from. Arguably this file shouldn't test for "" (covered in test/built-ins/Temporal/Instant/from/argument-string-invalid.js) or objects at all.
|
|
||
| function testRoundtrip(year) { | ||
| const dateFromYearMonth = Temporal.PlainDate.from({ year, month: 1, day: 1 }, options); | ||
| for ([year, month, monthCode, day] of testData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for ([year, month, monthCode, day] of testData) { | |
| for (const [year, month, monthCode, day] of testData) { |
| TemporalHelpers.assertPlainDate( | ||
| Temporal.PlainDate.from({year: 2021, month: 12, day: 500}), | ||
| 2021, 12, "M12", 31, | ||
| "year/month/day with month and day need to be constrained"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mind seeing this test rewritten with a loop either, but won't insist on it here. (But test/built-ins/Temporal/PlainDate/from/with-year-monthCode-day-need-constrain.js should be consistent in either case.)
|
|
||
| function testRoundtrip(year) { | ||
| const dateFromYearMonth = Temporal.PlainDateTime.from({ year, month: 1, day: 1, hour: 12, minute: 34, second: 56, millisecond: 987, microsecond: 654, nanosecond: 321 }, options); | ||
| for ([year, month, monthCode, day] of testData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for ([year, month, monthCode, day] of testData) { | |
| for (const [year, month, monthCode, day] of testData) { |
|
|
||
| function testRoundtrip(year) { | ||
| const dateFromYearMonth = Temporal.ZonedDateTime.from({ year, month: 1, day: 1, hour: 12, minute: 34, second: 56, millisecond: 987, microsecond: 654, nanosecond: 321, timeZone: "UTC" }, options); | ||
| for ([year, month, monthCode, day] of testData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for ([year, month, monthCode, day] of testData) { | |
| for (const [year, month, monthCode, day] of testData) { |
And move functionality into existing tests.