-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(operator): add elementAt #305
Conversation
|
||
module.exports = function (suite) { | ||
|
||
var oldElementAtWithImmediateScheduler = RxOld.Observable.range(0, 25, RxOld.Scheduler.immediate).elementAt(5); |
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.
As same as test case #303, this operator does not accept any schedulers. I do not feel let those kind of tests belong under current micro test category (immediate / current thread) is correct categorization, maybe need new category such as default
?
1a708a9
to
783b344
Compare
var expected = '-----x|'; | ||
var defaultValue = '42'; | ||
|
||
//expectObservable(source.elementAt(3, defaultValue)).toBe(expected, { x: defaultValue }); |
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.
Tried to follow test case description using marble diagrams but having some trouble with specific case. In case of this, actual result is 42|complete()
arrives in same frame. Seems this is related with issue #304 - am I understand correctly?
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.
You mean actual result is -----[42,|]
? where [...]
happens in the same frame
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.
@staltz Yes, correct. My expression wasn't clear enough.
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.
When, it seems clear we need the [a,b]
syntax in the DSL then. Even Meijer suggested it
783b344
to
71612e0
Compare
I'm ahead of you. It'll be in there tomorrow |
@Blesh Shall I close PR then? |
Nah, leave it open and wait for the testing changes to land. |
Testing changes are part of #307 |
|
||
it("should return default value if index is out of range", function() { | ||
var source = hot('--a--|', { a: 'a' }); | ||
var expected = '-----x|'; |
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.
Okay, once you rebase, this can now be:
var expected = '-----(x|)';
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.
Yes, just saw changes merged and about to start work on changes. Thanks!
71612e0
to
f15e3c7
Compare
Updated changes with
|
b422c2c
to
3658db5
Compare
|
||
it("should return default value if index is out of range", function() { | ||
var source = hot('--a--|'); | ||
var expected = '-----(x|'; |
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.
This can be closed like -----(x|)
, it will technically work like you've done it because of the naive implementation, but it's probably better to close the group in case the implementation changes.
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.
Agreed. let me update quickly to close.
3658db5
to
d0aa6f9
Compare
Updated changes with
|
496433e
to
87a50f7
Compare
Additional correction I forgot to do is updated. |
Awesome... I'll look at this later this evening or in the morning. |
- adds ArgumentOutOfRangeError error type - adds elementAt operator
87a50f7
to
d40746d
Compare
Effort to add operator exists in current RxJS, picking up relatively simple operator as starting point.