2020-09-22 20:06:10 +03:00
|
|
|
/*
|
2024-09-09 16:57:16 +03:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-11-21 14:24:59 +03:00
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
2020-09-22 20:06:10 +03:00
|
|
|
|
2024-09-09 16:57:16 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
Please see LICENSE files in the repository root for full details.
|
2020-09-22 20:06:10 +03:00
|
|
|
*/
|
|
|
|
|
2024-10-15 16:57:26 +03:00
|
|
|
import withValidation from "../../../../src/components/views/elements/Validation";
|
2020-09-22 20:06:10 +03:00
|
|
|
|
2022-11-21 14:24:59 +03:00
|
|
|
describe("Validation", () => {
|
|
|
|
it("should handle 0 rules", () => {
|
|
|
|
const handler = withValidation({
|
|
|
|
rules: [],
|
|
|
|
});
|
2022-12-12 14:24:14 +03:00
|
|
|
return expect(
|
|
|
|
handler({
|
|
|
|
value: "value",
|
|
|
|
focused: true,
|
|
|
|
}),
|
|
|
|
).resolves.toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
valid: true,
|
|
|
|
}),
|
|
|
|
);
|
2022-11-21 14:24:59 +03:00
|
|
|
});
|
|
|
|
});
|