1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-30 00:58:30 +02:00

run added password reset and verification sent hooks tests

This commit is contained in:
Gani Georgiev
2022-07-19 14:20:28 +03:00
parent 383b2a1279
commit f295ce9403
5 changed files with 86 additions and 36 deletions

View File

@@ -27,7 +27,7 @@ type ApiScenario struct {
ExpectedContent []string
NotExpectedContent []string
ExpectedEvents map[string]int
// test events
// test hooks
BeforeFunc func(t *testing.T, app *TestApp, e *echo.Echo)
AfterFunc func(t *testing.T, app *TestApp, e *echo.Echo)
}
@@ -81,6 +81,12 @@ func (scenario *ApiScenario) Test(t *testing.T) {
t.Errorf("[%s] Expected status code %d, got %d", prefix, scenario.ExpectedStatus, res.StatusCode)
}
// @todo consider replacing with sync.WaitGroup
//
// apply a small delay before checking the expectations to ensure
// that all fired go routines have complicated before cleaning up the app instance
time.Sleep(5 * time.Millisecond)
if len(scenario.ExpectedContent) == 0 && len(scenario.NotExpectedContent) == 0 {
if len(recorder.Body.Bytes()) != 0 {
t.Errorf("[%s] Expected empty body, got \n%v", prefix, recorder.Body.String())