Files
common/packages/util/src/is/observable.spec.ts
T
2021-01-03 11:20:22 +01:00

25 lines
596 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isObservable } from '.';
describe('isObservable', (): void => {
it('returns true on valid observables', (): void => {
expect(
isObservable({ next: (): boolean => true })
).toEqual(true);
});
it('returns false on invalid objects', (): void => {
expect(
isObservable('notAnObservable')
).toEqual(false);
});
it('returns false on invalid next functions', (): void => {
expect(
isObservable({ next: true })
).toEqual(false);
});
});