package driver import ( "context" "sync" "onehouse/protocol" ) const ( testDeviceID = "01K2K7M5TZ3J7W4Q9X8N6P2RVA" testOtherDeviceID = "01K2K7M5TZ3J7W4Q9X8N6P2RVB" testCommandID = "01K2K7M5TZ3J7W4Q9X8N6P2RVF" ) type recordingTransport struct { mu sync.Mutex publications []protocol.Publication err error } func (p *recordingTransport) Publish(_ context.Context, publication protocol.Publication) error { p.mu.Lock() defer p.mu.Unlock() p.publications = append(p.publications, publication) return p.err } func (p *recordingTransport) messages() []protocol.Publication { p.mu.Lock() defer p.mu.Unlock() return append([]protocol.Publication(nil), p.publications...) } func (p *recordingTransport) setError(err error) { p.mu.Lock() defer p.mu.Unlock() p.err = err }