package main import ( "io/ioutil" "os" "time" "testing" "github.com/kataras/iris/httptest" ) func TestURLShortener(t *testing.T) { // temp db file f, err := ioutil.TempFile("", "shortener") if err != nil { t.Fatalf("creating temp file for database failed: %v", err) } db := NewDB(f.Name()) app := newApp(db) e := httptest.New(t, app) originalURL := "https://google.com" // save e.POST("/shorten"). WithFormField("url", originalURL).Expect(). Status(httptest.StatusOK).Body().Contains("