Skip to content

Commit ffad421

Browse files
committed
test(calendar): update test case of formatWeekDay
1 parent 1475b9d commit ffad421

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/calendar_test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,15 @@ describe("Calendar", function () {
162162
});
163163

164164
it("should correctly format weekday using formatWeekDay prop", function () {
165-
const calendar = getCalendar({ formatWeekDay: (day) => day[0] });
165+
const mockFormattedWeekDay = "mockFormattedWeekDay";
166+
const formatWeekDay = sinon.fake.returns(mockFormattedWeekDay);
167+
const calendar = getCalendar({ formatWeekDay });
168+
sinon.assert.alwaysCalledWith(formatWeekDay, sinon.match.date);
166169
calendar
167170
.find(".react-datepicker__day-name")
168-
.forEach((dayName) => expect(dayName.text()).to.have.length(1));
171+
.forEach((dayName) =>
172+
expect(dayName.text()).to.equals(mockFormattedWeekDay)
173+
);
169174
});
170175

171176
it("should contain the correct class when using the weekDayClassName prop", () => {

0 commit comments

Comments
 (0)