Rxjs: Identify all tests that have not been updated to proper imports and "run mode"

Created on 13 Mar 2019  路  2Comments  路  Source: ReactiveX/rxjs

Just a list, not the fixes.

The work here is simple: Create a list or spreadsheet we can edit that tracks all of the tests in our suite that need to be updated in two different ways:

  1. Imports need to be "modernized"
  2. TestScheduler usage needs to be using "run mode".

Identify tests without "modernized" imports

A lot of work was already done here, but there's still some work that needs to be done. Basically, we need to update tests to make sure they are all importing from rxjs, rxjs/operators, rxjs/testing, etc, and NOT importing like import * as Rx from 'rxjs'.

We also need to make sure all operator usage is "pipeable". There are still a few tests where they're being "dot-chained" which isn't what we want.

Identify tests that need to use "run mode"

Run mode is testing with TestScheduler.prototype.run like so:

let testScheduler: TestScheduler;

beforeEach(() => {
  // "defaultObservableComparar" isn't a real thing, I forgot what it's called :P haha.
  testScheduler = new TestScheduler(defaultObservableComparer); 
});

it('should be a test like this', () => {
  testScheduler.run(({ hot, cold, expectObservable }) => {
     const source = hot('---a--b--c--d--|');
     const subs = '     -----^----------!';
     const expected = '      --b--c--d--|';
     expect(source, subs).toBe(expected);
  });
});

Expected result

A list we can use to track progress on updating these files.

Impact

It will drive a LOT of work for people, particularly people new to contributing to the code base. This work will enable us to more cleanly move to RxJS v 7 and beyond!

Moving to using "run mode" will enable us to use a code formatter (such as Prettier or Clang format) on the library, because we won't have to worry about jacking up marble diagrams anymore (because we can use spaces in the strings more effectively). This will help others contribute to the codebase by making it more readable.

critical Help Wanted

Most helpful comment

I've created a list of all (I hope) NOT "modernized" imports.
Here it's.

NOT "modernized" imports

Spec Root folder

  • [x] exports-spec.ts link
  • [x] Notification-spec.ts link
  • [x] Observable-spec.ts link
  • [x] root-module-spec.ts link
  • [x] Subject-spec.ts link
  • [x] Subscription-spec.ts link

Spec dtslint

  • [x] partition-spec.ts link

Spec Helpers

  • [x] test-helper.ts link
  • [x] testScheduler-ui.ts link

Spec Observables

  • [x] IteratorObservable-spec.ts link

Spec Operators

  • [x] defaultIfEmpty-spec.ts link
  • [x] forkJoin-spec.ts link
  • [x] let-spec.ts link
  • [x] partition-spec.ts link

Spec Subjects

  • [x] AsyncSubject-spec.ts link
  • [x] BehaviorSubject-spec.ts link
  • [x] ReplaySubject-spec.ts link

Spec Util

  • [x] subscribeToResult-spec.ts link
  • [x] UnsubscriptionError-spec.ts link

All 2 comments

I've created a list of all (I hope) NOT "modernized" imports.
Here it's.

NOT "modernized" imports

Spec Root folder

  • [x] exports-spec.ts link
  • [x] Notification-spec.ts link
  • [x] Observable-spec.ts link
  • [x] root-module-spec.ts link
  • [x] Subject-spec.ts link
  • [x] Subscription-spec.ts link

Spec dtslint

  • [x] partition-spec.ts link

Spec Helpers

  • [x] test-helper.ts link
  • [x] testScheduler-ui.ts link

Spec Observables

  • [x] IteratorObservable-spec.ts link

Spec Operators

  • [x] defaultIfEmpty-spec.ts link
  • [x] forkJoin-spec.ts link
  • [x] let-spec.ts link
  • [x] partition-spec.ts link

Spec Subjects

  • [x] AsyncSubject-spec.ts link
  • [x] BehaviorSubject-spec.ts link
  • [x] ReplaySubject-spec.ts link

Spec Util

  • [x] subscribeToResult-spec.ts link
  • [x] UnsubscriptionError-spec.ts link

Here a list of not pipeable operators which I have manage to find. (Hopely there are full list)
Some files are not included because they are have been listed on previous list (Not modernized imports).

NOT pipeable

Spec Root Folder

  • [x] Observable-spec.ts link (map, multicast, refCount, filter, count)
  • [x] Subject-spec.ts link (L417) (.delay)

Spec Operators

  • [ ] switch-spec.ts link (L35)
  • [ ] concatMap-spec.ts link (L18, L562 L591 L603 L615 L631 L646 L662 L677 .concatMap was called)
  • [ ] expand-spec.ts link (L22 L35)
  • [ ] let-spec.ts link (L10)
  • [ ] partition-spec.ts link (L244)
  • [ ] switch-spec.ts link (L35 L92 L313) Somewhere using Observable.of;
  • [ ] defaultIfEmpty-spec.ts link (L72 L74)
  • [ ] publish-spec.ts link (L45 L47 L49)
  • [ ] windowToggle-spec.ts link (L193 L195)
  • [ ] mergeScan-spec.ts link (.delay)
  • [ ] last-spec.ts link (L131)(.last)
  • [ ] publish-spec.ts link (L138) (.publish, .refCount)
  • [ ] share-spec.ts link (L246)(.repeat, .retry)
  • [ ] toPromise-spec.ts link (.toPromise)

Spec Observables

  • [ ] from-spec.ts link (L23)
  • [ ] concat-spec.ts link (L61)
  • [ ] interval-spec.ts link (.take)
  • [ ] generate-spec.ts link (.take)
  • [ ] merge-spec.ts link (L252) (.delay)

Spec Subjects

  • [ ] BehaviorSubject-spec.ts link
  • [ ] ReplaySubject-spec.ts link

Spec Util

  • [ ] isPromise-spec.ts link (.toPromise)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

dooreelko picture dooreelko  路  3Comments

jakovljevic-mladen picture jakovljevic-mladen  路  3Comments

matthewwithanm picture matthewwithanm  路  4Comments

giovannicandido picture giovannicandido  路  4Comments

shenlin192 picture shenlin192  路  3Comments