-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrea Maria Piana <[email protected]>
- Loading branch information
Showing
5 changed files
with
56 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(ns status-im.test.utils.security | ||
(:require [cljs.test :refer-macros [deftest is testing]] | ||
[status-im.utils.security :as security])) | ||
|
||
(def rtlo-link "http://google.com") | ||
(def rtlo-link-text "blah blah some other blah blah http://google.com blah bash") | ||
|
||
(deftest safe-link-test-happy-path | ||
(testing "an http link" | ||
(is (security/safe-link? "http://test.com"))) | ||
(testing "an https link" | ||
(is (security/safe-link? "https://test.com"))) | ||
(testing "a link without a a protocol" | ||
(is (security/safe-link? "test.com")))) | ||
|
||
(deftest safe-link-test-exceptions | ||
(testing "a javascript link" | ||
(is (not (security/safe-link? "javascript://anything")))) | ||
(testing "rtlo links" | ||
(is (not (security/safe-link? rtlo-link))))) | ||
|
||
(deftest safe-link-text-test-exceptions | ||
(testing "rtlo links" | ||
(is (not (security/safe-link-text? rtlo-link-text))))) |