google-search/search_test.go
rocketlaunchr-cto 53daeb7575 - update test
2021-07-01 12:03:01 +10:00

32 lines
548 B
Go

// Copyright 2020-21 PJ Engineering and Business Solutions Pty. Ltd. All rights reserved.
package googlesearch_test
import (
"context"
"testing"
"github.com/rocketlaunchr/google-search"
)
var ctx = context.Background()
func TestSearch(t *testing.T) {
q := "Hello World"
opts := googlesearch.SearchOptions{
Limit: 20,
}
returnLinks, err := googlesearch.Search(ctx, q, opts)
if err != nil {
t.Errorf("something went wrong: %v", err)
return
}
if len(returnLinks) == 0 {
t.Errorf("no results returned: %v", returnLinks)
}
}