UNPKG

@dolittle/sdk.resilience

Version:

Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.

22 lines (16 loc) 691 B
// Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. import { Subject } from 'rxjs'; import { describeThis } from '@dolittle/typescript.testing'; import { Cancellation } from '../../Cancellation'; describeThis(__filename, () => { const source = new Subject<void>(); const cancellation = new Cancellation(source); let completed = false; cancellation.subscribe({ complete: () => completed = true, }); source.complete(); it('should be cancelled', () => cancellation.cancelled.should.be.true); it('should complete', () => completed.should.be.true); });