In TS File,Datasource is initialised in a following way, public dataSource: Observable = new BehaviorSubject([]);

How to Initialize in SPEC file

1 Answers

0
Community On

In the .spec file, you will need to seed your datasource with an initial state, as per test practices. In javascript:

const datasource = new BehaviorSubject("a");

Additional: then run function to test that acts on datasource, i.e.:

setToB() // i.e: datasource.next("b")
datasource.subscribe(val => val.shouldEqual("b"))