test(docs-infra): add unit tests for rx-library examples (#38905)

This commit adds missing unit tests for all rx-library examples from the docs.

Closes #28017

PR Close #38905
This commit is contained in:
Sonu Kapoor
2020-09-28 17:56:59 +03:00
committed by Alex Rickabaugh
parent 5ef2c983b9
commit fd7146cc71
20 changed files with 473 additions and 158 deletions

View File

@ -0,0 +1,14 @@
import { of } from 'rxjs';
import { docRegionAjax } from './simple-creation';
describe('ajax', () => {
it('should make a request and console log the status and response', () => {
const console = {log: jasmine.createSpy('log')};
const ajax = jasmine.createSpy('ajax').and.callFake((url: string) => {
return of({status: 200, response: 'foo bar'});
});
docRegionAjax(console, ajax);
expect(console.log).toHaveBeenCalledWith(200, 'foo bar');
});
});