package main import ( "testing" "github.com/stretchr/testify/assert" ) var config = ` url: go.uber.org packages: thriftrw: repo: github.com/thriftrw/thriftrw-go yarpc: repo: github.com/yarpc/yarpc-go zap: url: go.uberalt.org repo: github.com/uber-go/zap ` func TestIndex(t *testing.T) { rr := CallAndRecord(t, config, "/") assert.Equal(t, 200, rr.Code) body := rr.Body.String() assert.Contains(t, body, "github.com/thriftrw/thriftrw-go") assert.Contains(t, body, "github.com/yarpc/yarpc-go") } func TestPackageShouldExist(t *testing.T) { rr := CallAndRecord(t, config, "/yarpc") AssertResponse(t, rr, 200, ` Nothing to see here. Please move along. `) } func TestNonExistentPackageShould404(t *testing.T) { rr := CallAndRecord(t, config, "/nonexistent") AssertResponse(t, rr, 404, ` 404 page not found `) } func TestTrailingSlash(t *testing.T) { rr := CallAndRecord(t, config, "/yarpc/") AssertResponse(t, rr, 200, ` Nothing to see here. Please move along. `) } func TestDeepImports(t *testing.T) { rr := CallAndRecord(t, config, "/yarpc/heeheehee") AssertResponse(t, rr, 200, ` Nothing to see here. Please move along. `) rr = CallAndRecord(t, config, "/yarpc/heehee/hawhaw") AssertResponse(t, rr, 200, ` Nothing to see here. Please move along. `) } func TestPackageLevelURL(t *testing.T) { rr := CallAndRecord(t, config, "/zap") AssertResponse(t, rr, 200, ` Nothing to see here. Please move along. `) }