Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save glendaviesnz/d5d9b160c698fcbc2c32f2bd1a7dac5f to your computer and use it in GitHub Desktop.
Save glendaviesnz/d5d9b160c698fcbc2c32f2bd1a7dac5f to your computer and use it in GitHub Desktop.
jasmine.Clock.tick and rxjs
describe('formPanel: FormFilterStore', function () {
it('Should generate new filters when formFilterChangeStream emits', function () {
jasmine.Clock.useMock();
formFilterStore.currentFormFiltersStream.subscribe(function(filters){
expect(filters.CQLFilter).toEqual('A new Cql Filter');
expect(filters.APIFilter).toEqual('[A new Api filter]');
});
formFilterStore.formFilterChangeStream.onNext({
filterType: 'date',
filters: {cqlFilterString: "A new Cql Filter", apiFilterString: "A new Api filter"}
});
// rxjs subject has debounce of 1 sec so force clock past this
jasmine.Clock.tick(1001);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment