Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix: fix of tests after changing the return type
Browse files Browse the repository at this point in the history
  • Loading branch information
MitanOmar committed Mar 30, 2023
1 parent a4b1812 commit 979e411
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/validators/moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function validateMoment(options = { gt: null, lt: null }) {
}
let valid = !!newValue && newValue._isValid;
if (!valid) {
return valid;
return "false";
}

if (options.gt) {
Expand Down
12 changes: 7 additions & 5 deletions tests/unit/validators/moment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import validateMoment from "timed/validators/moment";

module("Unit | Validator | moment", function () {
test("works without value", function (assert) {
assert.false(validateMoment()("key", null, null, {}, {}));
assert.strictEqual(validateMoment()("key", null, null, {}, {}), "false");
assert.true(validateMoment()("key", moment(), null, {}, {}));
});

Expand All @@ -19,14 +19,15 @@ module("Unit | Validator | moment", function () {
)
);

assert.false(
assert.strictEqual(
validateMoment({ gt: "otherKey" })(
"key",
moment(),
null,
{},
{ otherKey: moment().add(1, "second") }
)
),
"false"
);
});

Expand All @@ -41,14 +42,15 @@ module("Unit | Validator | moment", function () {
)
);

assert.false(
assert.strictEqual(
validateMoment({ lt: "otherKey" })(
"key",
moment(),
null,
{},
{ otherKey: moment().add(-1, "second") }
)
),
"false"
);
});

Expand Down

0 comments on commit 979e411

Please sign in to comment.