-
Notifications
You must be signed in to change notification settings - Fork 458
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
Update temporalHelpers.js #3861
Conversation
c766300
to
9f7d88a
Compare
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.
Fix SpecificOffsetTimeZone helper class so that it correctly implements the time zone protocol. Previously, some tests were passing but not actually exercising the expected codepaths.
I definitely intended the []
as a stub, because it hadn't been needed so far. Now that it's needed for the time zone offset tests, seems great to implement it 😄
Thanks!
getPossibleInstantsFor() { | ||
return []; | ||
getPossibleInstantsFor(dt) { | ||
if (typeof this._offsetValue !== 'number' || Math.abs(this._offsetValue) >= 86400e9 || isNaN(this._offsetValue)) return []; |
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 think if any of these conditions are true, the test helper is being misused ... but I don't mind having this here.
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.
If I remember correctly, I did it this way so that tests would fail in the right place in cases where the offset was invalid: either not a number or out of range. Otherwise, the failures would happen in the next line here in temporalHelpers, instead of actually exercising Temporal implementations' ability to reject invalid offset time zone IDs.
* Fix SpecificOffsetTimeZone so that it correctly implements the time zone protocol. Previously, tests were passing but not actually exercising the expected codepaths. * Add assertDateDuration function, which makes it shorter to assert durations that only contain date components.
9f7d88a
to
460aa5c
Compare
SpecificOffsetTimeZone
helper class so that it correctly implements the time zone protocol. Previously, some tests were passing but not actually exercising the expected codepaths.assertDateDuration
function, which makes it shorter to assert durations that only contain date components.