Kristiyan Kostadinov e86a1d3441 docs: make all examples compatible with strict mode (#41999)
Turns on the `strict` compiler flag and resolves the compilation errors in the various AIO examples.

PR Close #41999
2021-05-17 10:42:18 -07:00

24 lines
676 B
TypeScript

import { docRegionError, docRegionPromise } from './promises';
describe('promises', () => {
it('should print 2', (doneFn: DoneFn) => {
const consoleSpy = jasmine.createSpyObj<Console>('console', ['log']);
const pr = docRegionPromise(consoleSpy, 2);
pr.then((value) => {
expect(consoleSpy.log).toHaveBeenCalledTimes(1);
expect(consoleSpy.log).toHaveBeenCalledWith(2);
expect(value).toBe(4);
doneFn();
});
});
it('should throw an error', (doneFn: DoneFn) => {
const promise = docRegionError();
promise
.then(() => {
throw new Error('Promise should be rejected.');
},
() => doneFn());
});
});