Comments (5)
Thanks @petrzjunior
Personally I favor less nested calls and one-liners, but that's just my style
But I don't see an issue adding this line of code
If you can, please open a PR with tests, and I'll approve it
Thanks!
from observer-spy.
The release is available on:
npm package (@latest dist-tag)
- GitHub release
Your semantic-release bot
from observer-spy.
@petrzjunior
OK I changed (locally) the test you wrote to reflect your needs -
it('should allow single line style for expectErrors', () => {
expect(subscribeSpyTo(throwError(() => FAKE_ERROR_MESSAGE)).expectErrors().getError()).toEqual(FAKE_ERROR_MESSAGE);
})
And it doesn't really work... because the expectErrors
need to be defind before the Observable is subscribed to... so it will probably only work in cases there is an actual delay between values (which you wouldn't want to "wait for real" for those as this will make your tests slower...)
That's why you configure expectErrors: true
when calling subscribeSpyTo
and not after
So unless I'm missing something, I don't think this change will allow you to do what you need to do
from observer-spy.
@shairez I'm afraid you are correct here. My actual use case is similar to what you wrote and it does not work as I expected, since the value is emitted in the same tick. I'm guessing the change is not that useful then, sorry.
from observer-spy.
No worries my friend, I completely missed that one as well
We can't learn if we don't try... :)
Thanks for the contribution!
from observer-spy.
Related Issues (15)
- Promise support for `onComplete` HOT 4
- DISCUSSION 1: ObserverSpy API - Methods vs getters HOT 7
- DISCUSSION 2: ObserverSpy API - passing `OnComplete` callback in the constructor? HOT 8
- DISCUSSION 3: `subscribeAndSpyOn` + `unsubscribe` VS `spyOn` and `dispose` HOT 10
- `ObserverSpy` swallows errors HOT 1
- is there a method to count the number of times the source observable has emitted? HOT 5
- The automated release is failing 🚨
- Jest matchers HOT 8
- Requires ESM module transformation HOT 7
- Support for RxJS 7 HOT 1
- subscribeSpyTo is causing the ''ERROR TypeError: You provided 'undefined' where a stream was expected'' with the RxJS 7 upgrade HOT 2
- subscribeSpyTo<T> returns SubscriberSpy<unknown> instead of SubscriberSpy<T> HOT 6
- Await .onFirstEmitted() and .onEmitted(n); of observable values and then continue HOT 5
- Simplify usage with factory function and internal subscription handling HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from observer-spy.