Skip to content

Commit

Permalink
test: reorder to improve readibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Oct 24, 2023
1 parent 299ffb1 commit a52603f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/observable/channel/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
)

func TestReplayObservable(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
var (
n, values = 3, []int{1, 2, 3, 4, 5}
ctx, cancel = context.WithCancel(context.Background())
)
t.Cleanup(cancel)

n := 3
values := []int{1, 2, 3, 4, 5}

obsvbl, publishCh := channel.NewObservable[int]()
replayObsvbl := channel.Replay[int](ctx, n, obsvbl)

Expand Down Expand Up @@ -71,13 +71,11 @@ func TestReplayObservable(t *testing.T) {
}

func TestReplayObservable_Next(t *testing.T) {
ctx := context.Background()
n := 3
values := []int{1, 2, 3, 4, 5}
var n, ctx = 3, context.Background()

obsvbl, publishCh := channel.NewObservable[int]()
replayObsvbl := channel.Replay[int](ctx, n, obsvbl)
replayObsvbl, publishCh := channel.NewReplayObservable[int](ctx, n)

values := []int{1, 2, 3, 4, 5}
for _, value := range values {
publishCh <- value
time.Sleep(time.Millisecond)
Expand Down

0 comments on commit a52603f

Please sign in to comment.