Skip to content

Commit 2318786

Browse files
committed
Merge pull request rjsf-team#167 from mozilla-services/162-fix-intermittent-datewidget-test
Fix intermittent DateWidget test
1 parent 69c95d1 commit 2318786

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/StringField_test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,10 @@ describe("StringField", () => {
466466

467467
return SimulateAsync().click(node.querySelector("a.btn-now"))
468468
.then(() => {
469-
const expected = toDateString(parseDateString(new Date().toJSON(), true));
470-
expect(comp.state.formData).eql(expected);
469+
// Test that the two DATETIMEs are within 5 seconds of each other.
470+
const now = new Date().getTime();
471+
const timeDiff = now - new Date(comp.state.formData).getTime();
472+
expect(timeDiff).to.be.at.most(5000);
471473
});
472474
});
473475

0 commit comments

Comments
 (0)