Test/add mock tests (#24)

* add scrape unit test using httpmock lib
This commit is contained in:
T.v.Dein
2023-12-29 13:47:18 +01:00
committed by Thomas von Dein
parent c4e88d98f2
commit f893f9c3d7
9 changed files with 279 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ func WriteAd(dir string, ad *Ad, template string) error {
if err != nil {
return err
}
defer f.Close()
if runtime.GOOS == "windows" {
ad.Text = strings.ReplaceAll(ad.Text, "<br/>", "\r\n")
@@ -52,6 +53,7 @@ func WriteAd(dir string, ad *Ad, template string) error {
if err != nil {
return err
}
err = tmpl.Execute(f, ad)
if err != nil {
return err