-
Notifications
You must be signed in to change notification settings - Fork 34
/
api_test.go
44 lines (35 loc) · 1 KB
/
api_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package internalapi
import (
"github.com/transcom/mymove/pkg/testingsuite"
"log"
"testing"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/transcom/mymove/pkg/handlers"
"github.com/transcom/mymove/pkg/notifications"
)
// HandlerSuite is an abstraction of our original suite
type HandlerSuite struct {
handlers.BaseHandlerTestSuite
}
// SetupTest sets up the test suite by preparing the DB
func (suite *HandlerSuite) SetupTest() {
suite.DB().TruncateAll()
}
// AfterTest completes tests by trying to close open files
func (suite *HandlerSuite) AfterTest() {
for _, file := range suite.TestFilesToClose() {
file.Data.Close()
}
}
// TestHandlerSuite creates our test suite
func TestHandlerSuite(t *testing.T) {
logger, err := zap.NewDevelopment()
if err != nil {
log.Panic(err)
}
hs := &HandlerSuite{
BaseHandlerTestSuite: handlers.NewBaseHandlerTestSuite(logger, notifications.NewStubNotificationSender("milmovelocal", logger), testingsuite.CurrentPackage()),
}
suite.Run(t, hs)
}