summaryrefslogtreecommitdiff
path: root/scrape/parser_test.go
diff options
context:
space:
mode:
authorPhilipp Tanlak <philipp.tanlak@gmail.com>2023-08-10 18:18:01 +0200
committerPhilipp Tanlak <philipp.tanlak@gmail.com>2023-08-10 18:18:01 +0200
commit7e4cf39a0ba6ccbd5cc036700a8b1ff9358ecc3d (patch)
tree0f48b46e70162bad117f9f50d297487dee33266f /scrape/parser_test.go
parenta9b61f84070cc7ca0d6e26f187c745619a91422a (diff)
improve
Diffstat (limited to 'scrape/parser_test.go')
-rw-r--r--scrape/parser_test.go83
1 files changed, 0 insertions, 83 deletions
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 = `
-<html>
- <head>
- <title>Title</title>
- </head>
- <body>
- <h1>Headline</h1>
- <div class="container">
- <h2>Section 1</h2>
- <p>
- Paragraph 1
- </p>
- <div class="one">
- <div class="val">One</div>
- </div>
- <div class="inner">
- <h3>Inner H3</h3>
- </div>
- <div class="inner">
- <h3>Inner H3 next</h3>
- </div>
- </div>
- <div class="container">
- <h2>Section 2</h2>
- <p>
- Paragraph 2
- </p>
- <div class="one"><div class="val">Two</div></div>
- <div class="inner">
- <h3>Inner H3 2</h3>
- </div>
- <div class="inner">
- <h3>Inner H3 2 next</h3>
- </div>
- </div>
- </body>
-</html>
-`