
committed by
Kara Erickson

parent
7b3bcc23af
commit
5eb7426216
31
packages/zone.js/test/node/timer.spec.ts
Normal file
31
packages/zone.js/test/node/timer.spec.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {promisify} from 'util';
|
||||
|
||||
describe('node timer', () => {
|
||||
it('util.promisify should work with setTimeout', (done: DoneFn) => {
|
||||
const setTimeoutPromise = promisify(setTimeout);
|
||||
setTimeoutPromise(50, 'value')
|
||||
.then(
|
||||
value => {
|
||||
expect(value).toEqual('value');
|
||||
done();
|
||||
},
|
||||
error => { fail(`should not be here with error: ${error}.`); });
|
||||
});
|
||||
|
||||
it('util.promisify should work with setImmediate', (done: DoneFn) => {
|
||||
const setImmediatePromise = promisify(setImmediate);
|
||||
setImmediatePromise('value').then(
|
||||
value => {
|
||||
expect(value).toEqual('value');
|
||||
done();
|
||||
},
|
||||
error => { fail(`should not be here with error: ${error}.`); });
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user