woodpecker/server/web/opts_test.go
2017-09-20 12:29:57 -07:00

31 lines
668 B
Go

package web
import (
"testing"
"time"
)
func TestWithSync(t *testing.T) {
opts := new(Options)
WithSync(time.Minute)(opts)
if got, want := opts.sync, time.Minute; got != want {
t.Errorf("Want sync duration %v, got %v", want, got)
}
}
func TestWithDir(t *testing.T) {
opts := new(Options)
WithDir("/tmp/www")(opts)
if got, want := opts.path, "/tmp/www"; got != want {
t.Errorf("Want www directory %q, got %q", want, got)
}
}
func TestWithDocs(t *testing.T) {
opts := new(Options)
WithDocs("http://docs.drone.io")(opts)
if got, want := opts.docs, "http://docs.drone.io"; got != want {
t.Errorf("Want documentation url %q, got %q", want, got)
}
}