TinySkin/test/server_test.go
2023-10-12 20:46:07 +08:00

29 lines
520 B
Go

package test
import (
"context"
"os"
"testing"
"github.com/pelletier/go-toml/v2"
"github.com/samber/lo"
"github.com/xmdhs/authlib-skin/config"
"github.com/xmdhs/authlib-skin/server"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
ctx := context.Background()
b := lo.Must(os.ReadFile("config.toml"))
var config config.Config
lo.Must0(toml.Unmarshal(b, &config))
s, cancel := lo.Must2(server.InitializeRoute(ctx, config))
go func() {
s.ListenAndServe()
}()
goleak.VerifyTestMain(m)
cancel()
}