dateSummary.spec.jsx 989 B

123456789101112131415161718192021222324252627282930
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import DateSummary from 'app/components/organizations/timeRangeSelector/dateSummary';
  3. const start = new Date('2017-10-14T02:38:00.000Z');
  4. const end = new Date('2017-10-17T02:38:00.000Z'); // National Pasta Day
  5. describe('DateSummary', function () {
  6. let wrapper;
  7. const routerContext = TestStubs.routerContext();
  8. const createWrapper = (props = {}) =>
  9. mountWithTheme(<DateSummary start={start} end={end} {...props} />, routerContext);
  10. it('renders', async function () {
  11. wrapper = createWrapper();
  12. expect(wrapper).toSnapshot();
  13. });
  14. it('does not show times when it is midnight for start date and 23:59:59 for end date', function () {
  15. // Date Summary formats using system time
  16. // tests run on EST/EDT
  17. wrapper = createWrapper({
  18. start: new Date('2017-10-14T00:00:00.000-0400'),
  19. end: new Date('2017-10-17T23:59:59.000-0400'),
  20. });
  21. expect(wrapper.find('Time')).toHaveLength(0);
  22. });
  23. });