onefinestay / react-daterange-picker

Other
563 stars 208 forks source link

Tests fail when run on a weekend #137

Closed procidac closed 8 years ago

procidac commented 8 years ago

It seems tests are making assumptions on the current date being on a weekday. I am running tests on a Sunday and they fail with these errors:

SUMMARY:
✔ 186 tests completed
✖ 11 tests failed

FAILED TESTS:
  The CalendarDate Component
    sets the correct class
      ✖ by defininig the expected class name
        PhantomJS 2.1.1 (Mac OS X 0.0.0)
      Expected 'DateRangePicker__Date DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date'.
      /onefinestay/react-daterange-picker/src/tests.webpack.js:203:62

      by setting the expected bem modifiers
        ✖ when the provided date is today
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--today DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date DateRangePicker__Date--today'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:212:64

        ✖ when the provided date is not today
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:219:64

      by setting the expected bem states
        ✖ when the isDisabled prop is passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--is-disabled DateRangePicker__Date--weekend DateRangePicker__Date--weekend--is-disabled' to equal 'DateRangePicker__Date DateRangePicker__Date--is-disabled'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:265:64

        ✖ when the isDisabled prop is not passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:272:64

        ✖ when the isHighlightedDate prop is passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--is-highlighted DateRangePicker__Date--weekend DateRangePicker__Date--weekend--is-highlighted' to equal 'DateRangePicker__Date DateRangePicker__Date--is-highlighted'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:279:64

        ✖ when the isHighlightedDate prop is not passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:286:64

        ✖ when the isSelectedDate prop is passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--is-selected DateRangePicker__Date--weekend DateRangePicker__Date--weekend--is-selected' to equal 'DateRangePicker__Date DateRangePicker__Date--is-selected'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:293:64

        ✖ when the isInSelectedRange prop is passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--is-selected DateRangePicker__Date--weekend DateRangePicker__Date--weekend--is-selected' to equal 'DateRangePicker__Date DateRangePicker__Date--is-selected'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:300:64

        ✖ when the isInHighlightedRange prop is passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--is-selected DateRangePicker__Date--weekend DateRangePicker__Date--weekend--is-selected' to equal 'DateRangePicker__Date DateRangePicker__Date--is-selected'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:307:64

        ✖ when the isSelectedDate, isInSelectedRange, isInHighlightedRange props are not passed in
          PhantomJS 2.1.1 (Mac OS X 0.0.0)
        Expected 'DateRangePicker__Date DateRangePicker__Date--weekend' to equal 'DateRangePicker__Date'.
        /onefinestay/react-daterange-picker/src/tests.webpack.js:316:64

This can be easily reproduced by setting the date to a Saturday or a Sunday. If I set my date to a weekday, tests are passing again.

procidac commented 8 years ago

Also reproduced when pushing a new commit to this PR: https://github.com/onefinestay/react-daterange-picker/pull/136

AlanFoster commented 8 years ago

Good catch @procidac

Mind reviewing https://github.com/onefinestay/react-daterange-picker/pull/143