angular/aio/content/examples/rx-library/src/simple-creation.spec.ts
Sonu Kapoor 14ecc9ead2 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
2020-09-28 16:20:12 -04:00

15 lines
478 B
TypeScript

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');
});
});