36 lines
774 B
Go
36 lines
774 B
Go
package chi
|
|
|
|
import (
|
|
"testing"
|
|
|
|
peering "forge.cadoles.com/wpetit/go-http-peering"
|
|
"forge.cadoles.com/wpetit/go-http-peering/memory"
|
|
"github.com/go-chi/chi"
|
|
)
|
|
|
|
func TestMount(t *testing.T) {
|
|
|
|
r := chi.NewRouter()
|
|
store := memory.NewStore()
|
|
|
|
Mount(r, store)
|
|
|
|
routes := r.Routes()
|
|
|
|
if g, e := len(routes), 3; g != e {
|
|
t.Errorf("len(r.Routes()): got '%v', expected '%v'", g, e)
|
|
}
|
|
|
|
if g, e := routes[0].Pattern, peering.AdvertisePath; g != e {
|
|
t.Errorf("routes[0].Pattern: got '%v', expected '%v'", g, e)
|
|
}
|
|
|
|
if g, e := routes[1].Pattern, peering.PingPath; g != e {
|
|
t.Errorf("routes[1].Pattern: got '%v', expected '%v'", g, e)
|
|
}
|
|
|
|
if g, e := routes[2].Pattern, peering.UpdatePath; g != e {
|
|
t.Errorf("routes[2].Pattern: got '%v', expected '%v'", g, e)
|
|
}
|
|
}
|