package ortfomk import ( "testing" mapset "github.com/deckarep/golang-set" "github.com/stretchr/testify/assert" ) func TestIsLinkDead(t *testing.T) { val, err := IsLinkDead(`https://httpbin.org/status/404`) assert.NoError(t, err) assert.Equal(t, true, val) val, err = IsLinkDead(`https://google.com`) // If this becomes a 404 before this project is abandonned, I'll consider ortfo a success, even if the test starts failing. assert.NoError(t, err) assert.Equal(t, false, val) } func TestAllLinks(t *testing.T) { val := AllLinks(` DuckDuckGo — Privacy, simplified.
`) expected := mapset.NewSetFromSlice([]interface{}{"https://httpbin.org/status/404", "http://httpbin.org/status/404", "https://duckduckgo.com", "https://duckduckgo.com/assets/logo_social-media.png"}) assert.Equal(t, expected, val) }