2020-09-23 01:06:10 +08:00
|
|
|
/*
|
2024-09-09 21:57:16 +08:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-11-21 19:24:59 +08:00
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
2020-09-23 01:06:10 +08:00
|
|
|
|
2024-09-09 21:57:16 +08: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-23 01:06:10 +08:00
|
|
|
*/
|
|
|
|
|
2024-10-15 21:57:26 +08:00
|
|
|
import withValidation from "../../../../src/components/views/elements/Validation";
|
2020-09-23 01:06:10 +08:00
|
|
|
|
2022-11-21 19:24:59 +08:00
|
|
|
describe("Validation", () => {
|
|
|
|
it("should handle 0 rules", () => {
|
|
|
|
const handler = withValidation({
|
|
|
|
rules: [],
|
|
|
|
});
|
|
|
|
return expect(
|
|
|
|
handler({
|
|
|
|
value: "value",
|
|
|
|
focused: true,
|
|
|
|
}),
|
|
|
|
).resolves.toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
valid: true,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|