1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/test/frontend/lib/deferred.test.ts
2023-02-15 10:30:14 +01:00

15 lines
400 B
TypeScript

import Deferred from 'lib/deferred';
describe('Deferred', () => {
test('resolve a deferred promise', () => {
const deferred = new Deferred();
deferred.resolve(4);
expect(deferred.promise).resolves.toBe(4);
});
test('reject a deferred promise', () => {
const deferred = new Deferred();
deferred.reject('error');
expect(deferred.promise).rejects.toBe('error');
});
});