Skip to content

Commit

Permalink
fix(client): Fix Test for Reference Input
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Ostheimer committed Jan 9, 2020
1 parent 599f27b commit 56066e4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion client/src/Edit/elements/__tests__/referenceInput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ describe("ReferenceInput", () => {
).toBe(undefined);
});

it("should be not required with valid mail address", () => {
const props = { required: false };
const ref = { id: "mailto:[email protected]", model: null };
expect(
ReferenceInput.validate(ref, props as FieldProps<any> & {
required?: boolean;
})
).toBe(undefined);
});
it("should be not required with valid phone number", () => {
const props = { required: false };
const ref = { id: "tel:+491234567890", model: null };
expect(
ReferenceInput.validate(ref, props as FieldProps<any> & {
required?: boolean;
})
).toBe(undefined);
});
it("should be not required with valid external ref", () => {
const props = { required: false };
const ref = { id: "http://www.cellular.de", model: null };
Expand All @@ -62,7 +80,7 @@ describe("ReferenceInput", () => {
required?: boolean;
})
).toBe(
'This url is not valid. Links to the same domain need to start with "/" or to other domains with a valid protocol (http/https).'
'This url is not valid. Links to the same domain need to start with "/", to other domains with a valid protocol (http/https) or with a valid contact protocol (mailto/tel).'
);
});

Expand Down

0 comments on commit 56066e4

Please sign in to comment.