hiling_go/api/test/main_test.go
2024-05-22 11:26:15 +07:00

32 lines
591 B
Go
Executable File

package api_test
import (
"os"
"testing"
"time"
api "git.nochill.in/nochill/hiling_go/api"
db "git.nochill.in/nochill/hiling_go/db/sqlc"
"git.nochill.in/nochill/hiling_go/util"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/require"
)
func newTestServer(t *testing.T, store db.Store) *api.Server {
config := util.Config{
TokenSymmetricKey: util.RandomString(32),
TokenDuration: time.Minute,
}
server, err := api.NewServer(config, store)
require.NoError(t, err)
return server
}
func TestMain(m *testing.M) {
gin.SetMode(gin.TestMode)
os.Exit(m.Run())
}