angular/packages/zone.js/test/node/timer.spec.ts
Joey Perrott 9d898982ad refactor: migrate zone.js to prettier formatting (#55427)
Migrate formatting to prettier for zone.js from clang-format

PR Close #55427
2024-04-29 09:52:07 -07:00

36 lines
971 B
TypeScript

/**
* @license
* Copyright Google LLC 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}.`);
},
);
});
});