File: extractor_test.go

package info (click to toggle)
golang-github-advancedlogic-goose 0.0~git20210820.9d5822d%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 516 kB
  • sloc: makefile: 128; sh: 11
file content (26 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package goose

import (
	"testing"
)

func Test_title(t *testing.T) {
	titleUnmodified := "   foobar this - is it | bla ¿ "
	title := "foobar this - is it"

	c := NewCrawler(GetDefaultConfiguration())

	a, err := c.Crawl("<!DOCTYPE html><html><head><title>"+
		titleUnmodified+"</title></head></html>", "example.com")
	if err != nil {
		t.Error(err)
	}
	if a.TitleUnmodified != titleUnmodified {
		t.Error("`" + titleUnmodified + "` is extracted as `" + a.TitleUnmodified + "`")
	}

	if a.Title != title {
		t.Error("`" + a.Title + "` should be `" + title + "`")
	}

}