From b9038d5a7e7cf4d97ae9666101df4d6e1b1a5ff4 Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Thu, 11 Aug 2022 18:51:56 +0000 Subject: [PATCH] more tests for xpath --- scraping_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scraping_test.go b/scraping_test.go index 80f8bca..13f0140 100644 --- a/scraping_test.go +++ b/scraping_test.go @@ -21,10 +21,10 @@ const HTML_STRING = ` - product110100 - product220200 - product330300 - product440400 + product110100 + product220200 + product330300 + product440400 @@ -36,7 +36,10 @@ func TestFilterXPath(t *testing.T) { Want []string }{ {"//title", []string{"title"}}, - {"//table[@id='product-table']//tr//td[last()]", []string{"100", "200", "300", "400"}}, + {"//table[@id='product-table']//tr//td[last()]", []string{`100`, `200`, `300`, `400`}}, + {"//td[@class='price']", []string{`100`, `200`, `300`, `400`}}, + {"//table[@id='product-table']//tr//td[2]", []string{`10`, `20`, `30`, `40`}}, + {"//td[@class='stock']", []string{`10`, `20`, `30`, `40`}}, } for _, test := range tests {