2020-09-28 17:56:59 +03:00
|
|
|
import { of } from 'rxjs';
|
|
|
|
import { docRegionPromise } from './simple-creation.1';
|
|
|
|
|
|
|
|
describe('simple-creation.1', () => {
|
|
|
|
it('should create a promise from an observable and return an empty object', () => {
|
2021-05-08 16:02:03 +02:00
|
|
|
const consoleSpy = jasmine.createSpyObj<Console>('console', ['log']);
|
2020-09-28 17:56:59 +03:00
|
|
|
const fetch = () => of({foo: 42});
|
2021-05-08 16:02:03 +02:00
|
|
|
docRegionPromise(consoleSpy, fetch);
|
|
|
|
expect(consoleSpy.log.calls.allArgs()).toEqual([
|
2020-09-28 17:56:59 +03:00
|
|
|
[{foo: 42}],
|
|
|
|
['Completed'],
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|