-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(common): don't convert null to a string when flushing a mock request #21417
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {ddescribe, describe, iit, it} from '@angular/core/testing/src/testing_internal'; | ||
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.
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. why do you need to import custom 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. It's probably not necessary for this file, but the I could migrate them all off, but I'm not sure if any code changes would be necessary. 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. We would like to get rid of these long term, so let's not add more. Could you remove them from this test. |
||
|
||
import {HttpClient} from '../../src/client'; | ||
import {HttpClientTestingBackend} from '../src/backend'; | ||
|
||
describe('HttpClient TestRequest', () => { | ||
it('accepts a null body', () => { | ||
const mock = new HttpClientTestingBackend(); | ||
const client = new HttpClient(mock); | ||
|
||
let resp: any; | ||
client.post('/some-url', {test: 'test'}).subscribe(body => { resp = body; }); | ||
|
||
const req = mock.expectOne('/some-url'); | ||
req.flush(null); | ||
|
||
expect(resp).toBeNull(); | ||
}); | ||
}); |
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.
Why was this change needed?
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 directory previously did not have tests, so this package globbed all the files together. Now that it has tests, we need to somehow exclude them from the build.