-
Notifications
You must be signed in to change notification settings - Fork 48
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
Missing dependencies #67
Comments
Hi @ryansukale. Thanks for reporting the issue! Are you posting Could you please provide a minimal test case to reproduce the errors. Thanks! |
I am getting it with a regular post with a JSON body const responseBody = {hello: 'world'};
const request = {body: 'message'};
mock.post(path, {
status: 201,
body: JSON.stringify(responseBody)
});
ajaxObservable
.postJSON(path, request)
.subscribe(data => {
expect(data).to.deep.equal(responseBody);
done();
});
// And my postJSON is a wrapper around Rx.ajax method to post stuff, which does something like this.
return Rx.DOM.ajax({
url,
method: 'POST',
responseType: 'json',
body
}).map(({response}) => response); I went through the code in the MockXMLHttpRequest file. I am testing using mocha and sinon. Thats some more additional context if it helps. |
I was wondering why the tests aren't failing on nodejs... because I'll work on a fix. I'm thinking I'll add additional checks for What do you think? |
@ryansukale please try |
Since its a testing framework, why not use those dependencies? I will try with the version you specified and report back. |
I just tested the "xhr-mock": "2.4.1-preview.1" release and it works for my use case. Thanks! |
Had the same issue and |
Thanks for the reminder :) I just released |
Hey, thanks for this nice library.
It seems like when I tried to mock the post request and then make the request with a body, i got the following errors one after the other in MockXMLHttpRequest.js file.
Document is undefined
Blob is undefined
FormData is undefined
In order to make my post request work I had to do the following in my test file at the top.
My test environment is nodejs v8.9.1
Are you are missing these dependencies?
The text was updated successfully, but these errors were encountered: