youtuber-description-links
youtuber-description-links copied to clipboard
Putting tests next to what will be tested
Currently, the tests written for this project are in a separate tests folder. It's best practice in Go putting each test inside the package that defines what is to be tested. For example:
service/
youtube.go
youtube_test.go
extract_links.go
extract_links_test.go
Note that there are some cases where tests can be put in a separate folder, but it's pretty uncommon.
We can use some open source projects for guidance: https://github.com/kubernetes/kubernetes/tree/master/pkg/controlplane https://github.com/tsuru/tsuru/tree/master/api https://github.com/cockroachdb/cockroach/tree/master/pkg/base https://github.com/golang/go/tree/master/src/bytes (Go's standard bytes package)