41 lines
922 B
Go
41 lines
922 B
Go
package playback
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestStatusPreservesValues(t *testing.T) {
|
|
wantErr := errors.New("producer missing")
|
|
status := Status{
|
|
Unit: UnitVideo,
|
|
State: StateReconnecting,
|
|
Attempt: 2,
|
|
FailedAttempts: 1,
|
|
RetryIn: time.Second,
|
|
Err: wantErr,
|
|
}
|
|
|
|
if status.Unit != UnitVideo {
|
|
t.Errorf("Unit = %v, want %v", status.Unit, UnitVideo)
|
|
}
|
|
|
|
if !errors.Is(status.Err, wantErr) {
|
|
t.Errorf("Err = %v, want %v", status.Err, wantErr)
|
|
}
|
|
|
|
if status.State != StateReconnecting {
|
|
t.Errorf("State = %v, want %v", status.State, StateReconnecting)
|
|
}
|
|
if status.Attempt != 2 {
|
|
t.Errorf("Attempt = %d, want 2", status.Attempt)
|
|
}
|
|
if status.FailedAttempts != 1 {
|
|
t.Errorf("FailedAttempts = %d, want 1", status.FailedAttempts)
|
|
}
|
|
if status.RetryIn != time.Second {
|
|
t.Errorf("RetryIn = %s, want %s", status.RetryIn, time.Second)
|
|
}
|
|
}
|