forked from JohannesKaufmann/html-to-markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdown_test.go
33 lines (26 loc) · 1.05 KB
/
markdown_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package md
import "testing"
func TestDefaultGetAbsoluteURL_NoDomain(t *testing.T) {
input := "/page.html?key=val#hash"
expected := input
res := DefaultGetAbsoluteURL(nil, input, "")
if res != expected {
t.Errorf("expected '%s' but got '%s'", expected, res)
}
}
func TestDefaultGetAbsoluteURL_Domain(t *testing.T) {
input := "/page.html?key=val#hash"
expected := "http://test.com" + input
res := DefaultGetAbsoluteURL(nil, input, "test.com")
if res != expected {
t.Errorf("expected '%s' but got '%s'", expected, res)
}
}
func TestDefaultGetAbsoluteURL_DataURI(t *testing.T) {
input := "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
expected := input
res := DefaultGetAbsoluteURL(nil, input, "test.com")
if res != expected {
t.Errorf("expected '%s' but got '%s'", expected, res)
}
}