Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for get rss feed endpoint #71

Merged
merged 1 commit into from
Apr 10, 2022
Merged

Conversation

orthur
Copy link
Contributor

@orthur orthur commented Apr 3, 2022

first test for getFeedCtrl from server.go

@umputun I would add more tests, after going through your review comments

@orthur orthur requested a review from umputun as a code owner April 3, 2022 12:34
@orthur
Copy link
Contributor Author

orthur commented Apr 3, 2022

server_test.go runs inside feed-master/app/api directory, hence can't find templates.

ok  	github.com/umputun/feed-master/app	0.008s	coverage: 5.1% of statements
panic: html/template: pattern matches no files: `webapp/templates/*`

goroutine 1 [running]:
html/template.Must(...)
	/opt/hostedtoolcache/go/1.17.7/x64/src/html/template/template.go:374
github.com/umputun/feed-master/app/api.init()
	/home/runner/work/feed-master/feed-master/app/api/web.go:18 +0x65
FAIL	github.com/umputun/feed-master/app/api	0.010s

should templates set by absolute path?
also found this workaround

app/api/server_test.go Outdated Show resolved Hide resolved
app/api/server_test.go Show resolved Hide resolved
app/api/server_test.go Outdated Show resolved Hide resolved
app/api/server_test.go Outdated Show resolved Hide resolved
@umputun
Copy link
Owner

umputun commented Apr 3, 2022

I have changed the server a little bit to make it more testable. Added a simple test as well

@orthur
Copy link
Contributor Author

orthur commented Apr 4, 2022

I have added omitempty for image tags, without it feed would have empty URLs

@umputun umputun merged commit 67e4cba into umputun:master Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants