generated from snivilised/astrolib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
038923a
commit 8f328c2
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package rx_test | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/fortytw2/leaktest" | ||
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok | ||
. "github.com/onsi/gomega" //nolint:revive // gomega ok | ||
"github.com/snivilised/lorax/rx" | ||
) | ||
|
||
var _ = Describe("Observable operator", func() { | ||
Context("Send", func() { | ||
When("channel is buffered", func() { | ||
It("🧪 should: ", func() { | ||
// rxgo: Test_Observable_Send | ||
defer leaktest.Check(GinkgoT())() | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
ch := make(chan rx.Item[int], 10) | ||
testObservable[int](ctx, 1, 2, 3, errFoo).Send(ch) | ||
Expect(rx.Of(1)).To(Equal(<-ch)) | ||
Expect(rx.Of(2)).To(Equal(<-ch)) | ||
Expect(rx.Of(3)).To(Equal(<-ch)) | ||
Expect(rx.Error[int](errFoo)).To(Equal(<-ch)) | ||
}) | ||
}) | ||
|
||
When("channel is not buffered", func() { | ||
It("🧪 should: ", func() { | ||
defer leaktest.Check(GinkgoT())() | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
ch := make(chan rx.Item[int]) | ||
testObservable[int](ctx, 1, 2, 3, errFoo).Send(ch) | ||
Expect(rx.Of(1)).To(Equal(<-ch)) | ||
Expect(rx.Of(2)).To(Equal(<-ch)) | ||
Expect(rx.Of(3)).To(Equal(<-ch)) | ||
Expect(rx.Error[int](errFoo)).To(Equal(<-ch)) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters