From 7e4cf39a0ba6ccbd5cc036700a8b1ff9358ecc3d Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Thu, 10 Aug 2023 18:18:01 +0200 Subject: improve --- scrape/parser_test.go | 83 --------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 scrape/parser_test.go (limited to 'scrape/parser_test.go') diff --git a/scrape/parser_test.go b/scrape/parser_test.go deleted file mode 100644 index 4eb515d..0000000 --- a/scrape/parser_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package scrape - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestParser(t *testing.T) { - o := ParseFromJSON(html, `{ - "title": "head > title", - "headline": "body h1", - "sections": { - "#each": ".container", - "head": "h2", - "text": "p", - "inner": { - "#each": ".inner", - "headline": "h3" - }, - "one": { - "#element": ".one", - "value": ".val" - } - } - }`) - require.Equal(t, o, nil) - - b, _ := json.MarshalIndent(o, "", " ") - fmt.Println(string(b)) -} - -func TestParser2(t *testing.T) { - o := ParseFromJSON(html, `{ - "#each": ".container", - "head": "h2", - "text": "p" - }`) - - b, _ := json.MarshalIndent(o, "", " ") - fmt.Println(string(b)) -} - -var html = ` - - - Title - - -

Headline

-
-

Section 1

-

- Paragraph 1 -

-
-
One
-
-
-

Inner H3

-
-
-

Inner H3 next

-
-
-
-

Section 2

-

- Paragraph 2 -

-
Two
-
-

Inner H3 2

-
-
-

Inner H3 2 next

-
-
- - -` -- cgit v1.2.3