jaegertracing/jaeger-ui

[Bug]: Unit tests in src/utils/date.test.js fail in early January

yurishkuro opened this issue · 0 comments

What happened?

Tests started failing.

Summary of all failing tests
 FAIL  src/utils/date.test.js
  ● formatRelativeDate › Displays MM-DAY (Same month different date)

    expect(received).toBe(expected) // Object.is equality

    Expected: "Dec 29"
    Received: "Dec 29, 2023"

      226 |       day: 'numeric',
      227 |     });
    > 228 |     expect(formatRelativeDate(input)).toBe(output);
          |                                       ^
      229 |   });
      230 | });
      231 |

      at Object.toBe (src/utils/date.test.js:228:39)

The reason is because this test tries to render today-4 and expects MM-DAY, but when in the first 4 days of January this renders the date with the previous year.