diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-28 18:21:30 +0200 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-28 18:21:30 +0200 |
| commit | 48ff300980369d6c06729a3e15575b77365ff59e (patch) | |
| tree | 2898e1b0360c2a0901c2e2455675ce9f218d514f /js_test.go | |
| parent | b2881a3bc04063ba520fa9795fd459d32a1b8874 (diff) | |
add proxy to template
Diffstat (limited to 'js_test.go')
| -rw-r--r-- | js_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -75,3 +75,31 @@ func TestJSCompileError(t *testing.T) { Text: `Expected "from" but found ";"`, }) } + +func TestJSOptions(t *testing.T) { + js := ` + export const options = { + url: 'http://localhost/', + depth: 5, + allowedDomains: ['example.com'], + blockedDomains: ['google.com'], + allowedURLs: ['/foo'], + blockedURLs: ['/bar'], + proxy: 'http://proxy/', + rate: 1, + } + export default function() {} + ` + opts, _, err := flyscrape.Compile(js) + require.NoError(t, err) + require.Equal(t, flyscrape.ScrapeOptions{ + URL: "http://localhost/", + Depth: 5, + AllowedDomains: []string{"example.com"}, + BlockedDomains: []string{"google.com"}, + AllowedURLs: []string{"/foo"}, + BlockedURLs: []string{"/bar"}, + Proxy: "http://proxy/", + Rate: 1, + }, opts) +} |