From 062b36fe5725d1267c66db2e506b4131d78ce772 Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Fri, 11 Aug 2023 18:31:20 +0200 Subject: simplify project structure --- js/js_test.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 js/js_test.go (limited to 'js/js_test.go') 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) -} -- cgit v1.2.3