TinySkin/test/server_test.go
thehrz 0b880bece8
All checks were successful
CI / deploy (push) Successful in 57s
pref: rename project
2025-01-24 17:12:15 +08:00

28 lines
454 B
Go

package test
import (
"context"
"os"
"testing"
"tinyskin/config"
"tinyskin/server"
"github.com/pelletier/go-toml/v2"
"github.com/samber/lo"
)
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))
defer cancel()
go func() {
s.ListenAndServe()
}()
os.Exit(m.Run())
}