Skip to content

Commit

Permalink
Added addition unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Mar 5, 2021
1 parent e728f47 commit a279923
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/stdlib/html/document_exists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ import (

func TestDocumentExists(t *testing.T) {
Convey("DOCUMENT_EXISTS", t, func() {
Convey("Should return error if url is not a string", func() {
_, err := html.DocumentExists(context.Background(), values.None)

So(err, ShouldNotBeNil)
})

Convey("Should return error if options is not an object", func() {
_, err := html.DocumentExists(context.Background(), values.NewString("http://fsdfsdfdsdsf.fdf"), values.None)

So(err, ShouldNotBeNil)
})

Convey("Should return error if headers is not an object", func() {
opts := values.NewObjectWith(values.NewObjectProperty("headers", values.None))
_, err := html.DocumentExists(context.Background(), values.NewString("http://fsdfsdfdsdsf.fdf"), opts)

So(err, ShouldNotBeNil)
})

Convey("Should return 'false' when a website does not exist by a given url", func() {
out, err := html.DocumentExists(context.Background(), values.NewString("http://fsdfsdfdsdsf.fdf"))

Expand Down

0 comments on commit a279923

Please sign in to comment.