Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collapse recursive URLs to the HTML service
Eg; https://html.brow.sh/https://html.brow.sh/google.com jsut becomes google.com
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package browsh | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestRawTextServer(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Raw text server tests") | ||
} | ||
|
||
var _ = Describe("Raw text server", func() { | ||
Describe("De-recursing URLs", func() { | ||
It("should not do anything to normal URLs", func() { | ||
testURL := "https://google.com/path?q=hey" | ||
url, _ := deRecurseURL(testURL) | ||
Expect(url).To(Equal(testURL)) | ||
}) | ||
It("should de-recurse a single level", func() { | ||
testURL := "https://html.brow.sh/word" | ||
url, _ := deRecurseURL(testURL) | ||
Expect(url).To(Equal("word")) | ||
}) | ||
It("should de-recurse a multi level recurse without a URL ending", func() { | ||
testURL := "https://html.brow.sh/https://html.brow.sh" | ||
url, _ := deRecurseURL(testURL) | ||
Expect(url).To(Equal("")) | ||
}) | ||
It("should de-recurse a multi level recurse with a URL ending", func() { | ||
google := "https://google.com/path?q=hey" | ||
testURL := "https://html.brow.sh/https://html.brow.sh/" + google | ||
url, _ := deRecurseURL(testURL) | ||
Expect(url).To(Equal(google)) | ||
}) | ||
}) | ||
}) | ||
|
||
|