2020-09-10 04:17:03 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/kataras/iris/v12/httptest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestI18nLoaderFuncMap(t *testing.T) {
|
|
|
|
app := newApp()
|
|
|
|
|
|
|
|
e := httptest.New(t, app)
|
|
|
|
e.GET("/").Expect().Status(httptest.StatusOK).
|
|
|
|
Body().Equal("Hi 2 dogs")
|
2020-09-10 09:12:06 +02:00
|
|
|
e.GET("/singular").Expect().Status(httptest.StatusOK).
|
|
|
|
Body().Equal("Hi 1 dog")
|
2020-09-10 16:52:25 +02:00
|
|
|
e.GET("/members").Expect().Status(httptest.StatusOK).
|
|
|
|
Body().Equal("There are 42 members registered")
|
2020-09-10 04:17:03 +02:00
|
|
|
e.GET("/").WithHeader("Accept-Language", "el").Expect().Status(httptest.StatusOK).
|
|
|
|
Body().Equal("Γειά 2 σκυλί")
|
|
|
|
}
|