diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-11 18:31:20 +0200 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-11 18:31:20 +0200 |
| commit | 062b36fe5725d1267c66db2e506b4131d78ce772 (patch) | |
| tree | 998e5260feb1babac8dae512b56d67d8f20f7266 /js/js_test.go | |
| parent | 7e4cf39a0ba6ccbd5cc036700a8b1ff9358ecc3d (diff) | |
simplify project structure
Diffstat (limited to 'js/js_test.go')
| -rw-r--r-- | js/js_test.go | 40 |
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) -} |