Files
wehub-resource-sync ead81af521
CI / go (push) Waiting to run
CI / build (darwin, macos-14) (push) Waiting to run
CI / build (windows, windows-2025) (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 12:31:13 +08:00

30 lines
557 B
Go

package ipc
import (
"testing"
"time"
)
func TestDispatchSeekSendsIPCSeekMsgWithDuration(t *testing.T) {
var sent any
s := &Server{
disp: DispatcherFunc(func(msg any) {
sent = msg
}),
}
resp := s.dispatch(Request{Cmd: "seek", Value: 12.25})
if !resp.OK {
t.Fatalf("dispatch() response = %#v, want OK", resp)
}
got, ok := sent.(SeekMsg)
if !ok {
t.Fatalf("dispatch() sent %T, want ipc.SeekMsg", sent)
}
want := SeekMsg{Offset: 12250 * time.Millisecond}
if got != want {
t.Fatalf("dispatch() sent %#v, want %#v", got, want)
}
}