WiiCITMS/test/staff_query_test.go
2025-11-07 14:14:34 +08:00

39 lines
969 B
Go

package test
import (
"encoding/json"
"testing"
procHr "WiiCITMS/process/hr"
proc "WiiGoLibrary/apply/middle/process/v1"
)
// helper to must succeed a process
func mustOK(t *testing.T, p *proc.Process) {
t.Helper()
if p == nil || p.IsError() {
t.Fatalf("process error: %v", func() interface{} {
if p != nil {
return p.Error
}
return "nil"
}())
}
}
// TestQueryStaffs_Smoke runs QueryStaffs against existing DB data without creating any records.
func TestQueryStaffs_Smoke(t *testing.T) {
// Call with simple pagination only; DB is expected to already contain data per user's environment.
res, p := procHr.QueryStaffs(procHr.QueryStaffRequest{
Limit: 10,
Offset: 0,
})
mustOK(t, p)
// We don't assert on count/content since data is environment-dependent.
// Just ensure the call succeeds and returns a slice (possibly empty).
t.Logf("QueryStaffs returned %d records", len(res))
str, _ := json.Marshal(res)
t.Log(string(str))
}