naise_pos/api/main_test.go

32 lines
557 B
Go
Raw Permalink Normal View History

2023-03-12 11:01:43 +07:00
package api
import (
"os"
"testing"
2023-03-14 17:39:40 +07:00
"time"
2023-03-12 11:01:43 +07:00
2023-03-14 17:39:40 +07:00
db "git.nochill.in/nochill/naice_pos/db/sqlc"
"git.nochill.in/nochill/naice_pos/util"
2023-03-12 11:01:43 +07:00
"github.com/gin-gonic/gin"
_ "github.com/lib/pq"
2023-03-14 17:39:40 +07:00
"github.com/stretchr/testify/require"
2023-03-12 11:01:43 +07:00
)
2023-03-14 17:39:40 +07:00
func newTestServer(t *testing.T, store db.Store) *Server {
config := util.Config{
TokenSymmetricKey: util.RandomString(32),
TokenDuration: time.Minute,
}
server, err := NewServer(config, store)
require.NoError(t, err)
return server
}
2023-03-12 11:01:43 +07:00
func TestMain(m *testing.M) {
gin.SetMode(gin.TestMode)
os.Exit(m.Run())
}