mirror of
https://github.com/angular/angular.git
synced 2026-11-23 23:17:50 -05:00
The private util `isObservable` was actually just testing the same thing as`isSubscribable()`. As the implementation is closer to the function's name, let's only keep ``isSubscribable`. PR Close #49295
28 lines
1016 B
TypeScript
28 lines
1016 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 {isSubscribable} from '@angular/core/src/util/lang';
|
|
import {of} from 'rxjs';
|
|
|
|
describe('isSubscribable', () => {
|
|
it('should be true for an Observable', () => expect(isSubscribable(of(true))).toEqual(true));
|
|
|
|
it('should be true if the argument is the object with subscribe function',
|
|
() => expect(isSubscribable({subscribe: () => {}})).toEqual(true));
|
|
|
|
it('should be false if the argument is undefined',
|
|
() => expect(isSubscribable(undefined)).toEqual(false));
|
|
|
|
it('should be false if the argument is null', () => expect(isSubscribable(null)).toEqual(false));
|
|
|
|
it('should be false if the argument is an object',
|
|
() => expect(isSubscribable({})).toEqual(false));
|
|
|
|
it('should be false if the argument is a function',
|
|
() => expect(isSubscribable(() => {})).toEqual(false));
|
|
});
|