-
-
Notifications
You must be signed in to change notification settings - Fork 18
feat(test): add unit tests for Zip operator #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0273a4a
8b5b27b
15a7e23
38ab68f
060a5b6
3fe3861
8640795
ccfb943
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -661,11 +661,92 @@ func TestOperatorCreationCombineLatestAny(t *testing.T) { //nolint:paralleltest | |||||||
| } | ||||||||
|
|
||||||||
| func TestOperatorCreationZip(t *testing.T) { //nolint:paralleltest | ||||||||
samber marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| // @TODO: implement | ||||||||
| testWithTimeout(t, 100*time.Millisecond) | ||||||||
| is := assert.New(t) | ||||||||
|
|
||||||||
| t.Run("Zip with single observable", func(t *testing.T) { | ||||||||
| obs := Zip( | ||||||||
| Just[any](1, 2, 3), | ||||||||
| ) | ||||||||
|
|
||||||||
| values, err := Collect(obs) | ||||||||
| is.NoError(err) | ||||||||
|
|
||||||||
| is.Equal([][]any{ | ||||||||
| {1}, | ||||||||
| {2}, | ||||||||
| {3}, | ||||||||
| }, values) | ||||||||
| }) | ||||||||
|
|
||||||||
| t.Run("Zip with two observables", func(t *testing.T) { | ||||||||
| obs := Zip( | ||||||||
| Just[any](1, 2, 3), | ||||||||
| Just[any]("A", "B", "C"), | ||||||||
| ) | ||||||||
|
|
||||||||
| values, err := Collect(obs) | ||||||||
| is.NoError(err) | ||||||||
|
|
||||||||
| is.Equal([][]any{ | ||||||||
| {1, "A"}, | ||||||||
| {2, "B"}, | ||||||||
| {3, "C"}, | ||||||||
| }, values) | ||||||||
| }) | ||||||||
|
|
||||||||
| t.Run("Zip with three observables", func(t *testing.T) { | ||||||||
| obs := Zip( | ||||||||
| Just[any](1, 2, 3), | ||||||||
| Just[any]("A", "B", "C"), | ||||||||
| Just[any](true, false, true), | ||||||||
| ) | ||||||||
|
|
||||||||
| values, err := Collect(obs) | ||||||||
| is.NoError(err) | ||||||||
|
|
||||||||
| is.Equal([][]any{ | ||||||||
| {1, "A", true}, | ||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||
| {2, "B", false}, | ||||||||
| {3, "C", true}, | ||||||||
| }, values) | ||||||||
| }) | ||||||||
| } | ||||||||
|
|
||||||||
| func TestOperatorCreationZip2(t *testing.T) { //nolint:paralleltest | ||||||||
|
||||||||
| func TestOperatorCreationZip2(t *testing.T) { //nolint:paralleltest | |
| func TestOperatorCreationZip(t *testing.T) { | |
| t.Parallel() |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use lo.T2(...) instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.