-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f3ee37
commit 22a6152
Showing
5 changed files
with
14 additions
and
30 deletions.
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
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
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
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
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 |
---|---|---|
|
@@ -3,16 +3,14 @@ import { it, describe, expect } from "vitest" | |
|
||
describe("validations", () => { | ||
describe("validateEmail", () => { | ||
it("validates email", () => | ||
expect(validateEmail("[email protected]")).toEqual(true)) | ||
it("validates email", () => expect(validateEmail("[email protected]")).toEqual(true)) | ||
it("validates email with +", () => | ||
expect(validateEmail("[email protected]")).toEqual(true)) | ||
it("validates email with long tld", () => | ||
expect(validateEmail("[email protected]")).toEqual(true)) | ||
it("catches long invalid string", () => | ||
expect(validateEmail("@space.city")).toEqual(false)) | ||
it("catches empty string", () => | ||
expect(validateEmail("")).toEqual(false)) | ||
it("catches empty string", () => expect(validateEmail("")).toEqual(false)) | ||
it("catches undefined", () => | ||
expect(validateEmail(<any>undefined)).toEqual(false)) | ||
it("catches multi @", () => | ||
|
@@ -25,9 +23,7 @@ describe("validations", () => { | |
it("validates url", () => | ||
expect(validateHttpUrl("https://x.com")).toEqual(true)) | ||
it("validates url with long tld", () => | ||
expect(validateHttpUrl("https://lorem-ipsum.graphics")).toEqual( | ||
true, | ||
)) | ||
expect(validateHttpUrl("https://lorem-ipsum.graphics")).toEqual(true)) | ||
it("validates url with double subdomain", () => | ||
expect(validateHttpUrl("https://0.x.x.com")).toEqual(true)) | ||
it("catches ftp", () => | ||
|
@@ -36,8 +32,7 @@ describe("validations", () => { | |
expect(validateHttpUrl("lorem ipsum https://x.com")).toEqual(false)) | ||
it("catches unsafe http", () => | ||
expect(validateHttpUrl("http://x.com")).toEqual(false)) | ||
it("catches empty string", () => | ||
expect(validateHttpUrl("")).toEqual(false)) | ||
it("catches empty string", () => expect(validateHttpUrl("")).toEqual(false)) | ||
it("catches undefined", () => | ||
expect(validateHttpUrl(<any>undefined)).toEqual(false)) | ||
}) | ||
|