PromucFlow_constructor/app/client/src/widgets/PhoneInputWidget/widget/index.test.tsx
balajisoundar 02785b90b2
feat: Input, Phone no., Currency input widget (#10259)
* feat: Input, Phone no., Currency Widget

* cypress tests, jest test, QA and CR callouts

* fix tests

* Cypress and jest test fixes
2022-01-18 13:22:24 +05:30

32 lines
752 B
TypeScript

import { defaultValueValidation, PhoneInputWidgetProps } from "./index";
import _ from "lodash";
describe("defaultValueValidation", () => {
let result: any;
it("should validate defaulttext", () => {
result = defaultValueValidation(
"0000000000",
{} as PhoneInputWidgetProps,
_,
);
expect(result).toEqual({
isValid: true,
parsed: "0000000000",
messages: [""],
});
});
it("should validate defaulttext with object value", () => {
const value = {};
result = defaultValueValidation(value, {} as PhoneInputWidgetProps, _);
expect(result).toEqual({
isValid: false,
parsed: JSON.stringify(value, null, 2),
messages: ["This value must be string"],
});
});
});