Skip to content

Instantly share code, notes, and snippets.

@roytouw7
Created August 20, 2020 13:20
Show Gist options
  • Save roytouw7/e622d1faede866d334111af7c63fa2d3 to your computer and use it in GitHub Desktop.
Save roytouw7/e622d1faede866d334111af7c63fa2d3 to your computer and use it in GitHub Desktop.
test('isObjectOrSubjectConstructor should identifiy RxJS Subject or Object contructor nodes.', () => {
const [node] = createNode<ts.NewExpression>(`new Observable();`, ts.SyntaxKind.NewExpression);
const [node2] = createNode<ts.NewExpression>(`new Observable<number>();`, ts.SyntaxKind.NewExpression);
const [node3] = createNode<ts.NewExpression>(`new BehaviorSubject<string>();`, ts.SyntaxKind.NewExpression);
const [node4] = createNode<ts.NewExpression>(`new NoRxJSSubject<string>();`, ts.SyntaxKind.NewExpression);
expect(isObjectOrSubjectConstructor(node)).toBe(true);
expect(isObjectOrSubjectConstructor(node2)).toBe(true);
expect(isObjectOrSubjectConstructor(node3)).toBe(true);
expect(isObjectOrSubjectConstructor(node4)).toBe(false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment