2019-12-08 00:32:00 +05:30
|
|
|
import expect from 'app/test/unexpected';
|
2016-12-06 00:55:23 +05:30
|
|
|
|
|
|
|
describe('promise.prototype.finally', () => {
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should be invoked after promise resolved', () =>
|
|
|
|
expect(
|
2020-05-20 22:05:52 +05:30
|
|
|
new Promise((resolve) => Promise.resolve().finally(resolve)),
|
2019-11-27 14:33:32 +05:30
|
|
|
'to be fulfilled',
|
|
|
|
));
|
2016-12-06 00:55:23 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should be invoked after promise rejected', () =>
|
|
|
|
expect(
|
2020-05-20 22:05:52 +05:30
|
|
|
new Promise((resolve) =>
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(Promise.reject().finally(resolve), 'to be rejected'),
|
|
|
|
),
|
|
|
|
'to be fulfilled',
|
|
|
|
));
|
2016-12-06 00:55:23 +05:30
|
|
|
});
|