summaryrefslogtreecommitdiff
path: root/js/js_test.go
diff options
context:
space:
mode:
authorPhilipp Tanlak <philipp.tanlak@gmail.com>2023-08-11 18:31:20 +0200
committerPhilipp Tanlak <philipp.tanlak@gmail.com>2023-08-11 18:31:20 +0200
commit062b36fe5725d1267c66db2e506b4131d78ce772 (patch)
tree998e5260feb1babac8dae512b56d67d8f20f7266 /js/js_test.go
parent7e4cf39a0ba6ccbd5cc036700a8b1ff9358ecc3d (diff)
simplify project structure
Diffstat (limited to 'js/js_test.go')
-rw-r--r--js/js_test.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/js/js_test.go b/js/js_test.go
deleted file mode 100644
index f25c95b..0000000
--- a/js/js_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package js_test
-
-import (
- "io"
- "net/http"
- "testing"
-
- "flyscrape/flyscrape"
- "flyscrape/js"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestV8(t *testing.T) {
- opts, run, err := js.Compile("../examples/esbuild.github.io.js")
- require.NoError(t, err)
- require.NotNil(t, opts)
- require.NotNil(t, run)
-
- html := fetch(opts.URL)
- json, err := run(flyscrape.ScrapeParams{
- HTML: html,
- })
-
- require.NoError(t, err)
- t.Log(json)
-}
-
-func fetch(url string) string {
- resp, err := http.Get(url)
- if err != nil {
- return ""
- }
- defer resp.Body.Close()
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- return ""
- }
- return string(b)
-}