Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Last active September 16, 2018 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenomnomnominal/e891764be89ba8006332e5473c5dd81c to your computer and use it in GitHub Desktop.
Save phenomnomnominal/e891764be89ba8006332e5473c5dd81c to your computer and use it in GitHub Desktop.
import { tsquery } from '@phenomnomnominal/tsquery';
import { expect } from 'chai';
import { Rule } from './noCatchErrorInEffectChainRule';
describe('noCatchErrorInEffectChainRule', () => {
it('should create a lint error if "catchError()" is in an Effect chain', () => {
const sourceFile = tsquery.ast(`
export class MyEffects {
@Effect()
public myEffect = something.observable$.pipe(
catchError(() => {})
);
};
`);
const errors = Rule.prototype.apply(sourceFile);
const [error] = errors;
expect(errors.length).to.equal(1);
expect(error.getFailure()).to.include(`Using "catchError" in an @Effect() chain can`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment