Skip to content
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

Fix corner cases #460

Merged
merged 30 commits into from Apr 6, 2017
Merged

Fix corner cases #460

merged 30 commits into from Apr 6, 2017

Conversation

leshakoss
Copy link
Contributor

@leshakoss leshakoss commented Mar 10, 2017

No description provided.

@leshakoss leshakoss changed the title [WIP] Invalid Date tests and fixes Invalid values tests and fixes Apr 4, 2017
@leshakoss leshakoss changed the title Invalid values tests and fixes Fix corner cases Apr 4, 2017
new Date(NaN)
)
assert(result === false)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth to add a tests case with isSameDay(new Date(NaN), new Date(NaN))

Copy link
Member

@kossnocorp kossnocorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 👍

new Date(NaN)
)
assert(result === false)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test case for isAfter(new Date(NaN), new Date(NaN))

it('throws an exception if the end date of the compared time interval is `Invalid Date`', function () {
var block = areIntervalsOverlapping.bind(
null,
{start: new Date(2016, 10, 3), end: new Date(2016, 10, 7)},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use RangeError for the exception.

new Date(2012, 6 /* Jul */, 2)
])
assert(isNaN(result))
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add test case when the given array contains an unexpected value such as undefined.

CHANGELOG.md Outdated
@@ -328,6 +328,10 @@ This change log follows the format documented in [Keep a CHANGELOG].
)
```

- **BREAKING**: functions now throw `RangeError` if optional values passed to `options`
are not `undefined` or have expected values.
This change is introduced for consistency with ECMAScript's `Intl` which does the same.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about arithmetic operations with NaN

@leshakoss leshakoss modified the milestone: v2.0.0 Apr 5, 2017
@leshakoss leshakoss merged commit 0359561 into v2 Apr 6, 2017
@leshakoss leshakoss deleted the v2-NaN-tests branch April 6, 2017 06:58
leshakoss added a commit that referenced this pull request Apr 14, 2017
* Invalid Date tests for `addX`, `setX` and `subX`

* Invalid Date tests for `getX`

* Invalid Date tests for `startOfX`, `endOfX` and `lastDayOfX`

* Invalid Date tests for `isSameX`

* Invalid Date tests for `differenceInX`

* `isX(new Date(NaN))` tests

* `isAfter`, `isBefore` and `isEqual` Invalid Date tests

* Interval functions Invalid Date tests

* `compareAsc` and `compareDesc` Invalid Date tests

* `closestTo`, `closestIndexTo`, `max` and `min` Invalid Date tests

* Test `toDate` if `options.additionalDigits` is not 0, 1, 2 or undefined

* Test `parse` if baseDate is `Invalid Date`

* `distanceInWords` and `distanceInWordsStrict` invalid values tests

* Invalid `options.weekStartsOn` tests

* Invalid value implementation fixes

* `parse` implementation fix

* `weekStartsOn` implementation fix

* Rename `partialMethod` to `roundingMethod`

* `distanceInWordsStrict` implementation fix

* Rebuild typings

* `toDate` implementation fix

* Add CHANGELOG.md entry

* Add missing tests

* Make interval functions throw RangeError

* Fix @throws docs messages

* Add `@throws {RangeError}` to all functions docs

* Add `@param [options.additionalDigits]` to all functions docs

* Add `options.additionalDigits` tests to all functions

* Complete corner cases changelog entry

* Add missing `$ExpectedMistake`
leshakoss added a commit that referenced this pull request May 4, 2017
* Invalid Date tests for `addX`, `setX` and `subX`

* Invalid Date tests for `getX`

* Invalid Date tests for `startOfX`, `endOfX` and `lastDayOfX`

* Invalid Date tests for `isSameX`

* Invalid Date tests for `differenceInX`

* `isX(new Date(NaN))` tests

* `isAfter`, `isBefore` and `isEqual` Invalid Date tests

* Interval functions Invalid Date tests

* `compareAsc` and `compareDesc` Invalid Date tests

* `closestTo`, `closestIndexTo`, `max` and `min` Invalid Date tests

* Test `toDate` if `options.additionalDigits` is not 0, 1, 2 or undefined

* Test `parse` if baseDate is `Invalid Date`

* `distanceInWords` and `distanceInWordsStrict` invalid values tests

* Invalid `options.weekStartsOn` tests

* Invalid value implementation fixes

* `parse` implementation fix

* `weekStartsOn` implementation fix

* Rename `partialMethod` to `roundingMethod`

* `distanceInWordsStrict` implementation fix

* Rebuild typings

* `toDate` implementation fix

* Add CHANGELOG.md entry

* Add missing tests

* Make interval functions throw RangeError

* Fix @throws docs messages

* Add `@throws {RangeError}` to all functions docs

* Add `@param [options.additionalDigits]` to all functions docs

* Add `options.additionalDigits` tests to all functions

* Complete corner cases changelog entry

* Add missing `$ExpectedMistake`
leshakoss added a commit that referenced this pull request May 20, 2017
* Invalid Date tests for `addX`, `setX` and `subX`

* Invalid Date tests for `getX`

* Invalid Date tests for `startOfX`, `endOfX` and `lastDayOfX`

* Invalid Date tests for `isSameX`

* Invalid Date tests for `differenceInX`

* `isX(new Date(NaN))` tests

* `isAfter`, `isBefore` and `isEqual` Invalid Date tests

* Interval functions Invalid Date tests

* `compareAsc` and `compareDesc` Invalid Date tests

* `closestTo`, `closestIndexTo`, `max` and `min` Invalid Date tests

* Test `toDate` if `options.additionalDigits` is not 0, 1, 2 or undefined

* Test `parse` if baseDate is `Invalid Date`

* `distanceInWords` and `distanceInWordsStrict` invalid values tests

* Invalid `options.weekStartsOn` tests

* Invalid value implementation fixes

* `parse` implementation fix

* `weekStartsOn` implementation fix

* Rename `partialMethod` to `roundingMethod`

* `distanceInWordsStrict` implementation fix

* Rebuild typings

* `toDate` implementation fix

* Add CHANGELOG.md entry

* Add missing tests

* Make interval functions throw RangeError

* Fix @throws docs messages

* Add `@throws {RangeError}` to all functions docs

* Add `@param [options.additionalDigits]` to all functions docs

* Add `options.additionalDigits` tests to all functions

* Complete corner cases changelog entry

* Add missing `$ExpectedMistake`
leshakoss added a commit that referenced this pull request May 20, 2017
* Invalid Date tests for `addX`, `setX` and `subX`

* Invalid Date tests for `getX`

* Invalid Date tests for `startOfX`, `endOfX` and `lastDayOfX`

* Invalid Date tests for `isSameX`

* Invalid Date tests for `differenceInX`

* `isX(new Date(NaN))` tests

* `isAfter`, `isBefore` and `isEqual` Invalid Date tests

* Interval functions Invalid Date tests

* `compareAsc` and `compareDesc` Invalid Date tests

* `closestTo`, `closestIndexTo`, `max` and `min` Invalid Date tests

* Test `toDate` if `options.additionalDigits` is not 0, 1, 2 or undefined

* Test `parse` if baseDate is `Invalid Date`

* `distanceInWords` and `distanceInWordsStrict` invalid values tests

* Invalid `options.weekStartsOn` tests

* Invalid value implementation fixes

* `parse` implementation fix

* `weekStartsOn` implementation fix

* Rename `partialMethod` to `roundingMethod`

* `distanceInWordsStrict` implementation fix

* Rebuild typings

* `toDate` implementation fix

* Add CHANGELOG.md entry

* Add missing tests

* Make interval functions throw RangeError

* Fix @throws docs messages

* Add `@throws {RangeError}` to all functions docs

* Add `@param [options.additionalDigits]` to all functions docs

* Add `options.additionalDigits` tests to all functions

* Complete corner cases changelog entry

* Add missing `$ExpectedMistake`
kossnocorp pushed a commit that referenced this pull request Jun 20, 2017
* Invalid Date tests for `addX`, `setX` and `subX`

* Invalid Date tests for `getX`

* Invalid Date tests for `startOfX`, `endOfX` and `lastDayOfX`

* Invalid Date tests for `isSameX`

* Invalid Date tests for `differenceInX`

* `isX(new Date(NaN))` tests

* `isAfter`, `isBefore` and `isEqual` Invalid Date tests

* Interval functions Invalid Date tests

* `compareAsc` and `compareDesc` Invalid Date tests

* `closestTo`, `closestIndexTo`, `max` and `min` Invalid Date tests

* Test `toDate` if `options.additionalDigits` is not 0, 1, 2 or undefined

* Test `parse` if baseDate is `Invalid Date`

* `distanceInWords` and `distanceInWordsStrict` invalid values tests

* Invalid `options.weekStartsOn` tests

* Invalid value implementation fixes

* `parse` implementation fix

* `weekStartsOn` implementation fix

* Rename `partialMethod` to `roundingMethod`

* `distanceInWordsStrict` implementation fix

* Rebuild typings

* `toDate` implementation fix

* Add CHANGELOG.md entry

* Add missing tests

* Make interval functions throw RangeError

* Fix @throws docs messages

* Add `@throws {RangeError}` to all functions docs

* Add `@param [options.additionalDigits]` to all functions docs

* Add `options.additionalDigits` tests to all functions

* Complete corner cases changelog entry

* Add missing `$ExpectedMistake`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants