-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client): Fix Test for Reference Input
- Loading branch information
Marius Ostheimer
committed
Jan 9, 2020
1 parent
599f27b
commit 56066e4
Showing
1 changed file
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }; | ||
|
@@ -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).' | ||
); | ||
}); | ||
|
||
|