Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up threw assertions #81

Open
GoodForOneFare opened this issue May 12, 2016 · 5 comments
Open

Clean up threw assertions #81

GoodForOneFare opened this issue May 12, 2016 · 5 comments
Labels

Comments

@GoodForOneFare
Copy link
Member

We still have assert.okay(foo.threw, 'error message')-style assertions. These should probably be converted to assert.fail('error message';), or the original CoffeeScript should be altered to not use this pattern.

@GoodForOneFare
Copy link
Member Author

I looked into this, and it's probably easier to manually change stuff like

try
  foo();

assert.okay(foo.threw, 'error message')

to

try
   foo();
   assert.fail('error message')

@lemonmade
Copy link
Member

Do you have a list of places where this appears in code? Is this something we can lint for?

@GoodForOneFare
Copy link
Member Author

details_form_test.coffee (1 instance), state_test.coffee (3 instances), state_next_test.coffee. Definitely easier to fix manually because a couple of these have logic between the try and threw assertion.

Yes, we could lint for this. It could be added to #79, or be a new issue.

@lemonmade
Copy link
Member

Let's do a new issue for the linting rule. I'll tackle updating those instances.

@lemonmade lemonmade assigned lemonmade and unassigned lemonmade Jun 6, 2016
@lemonmade
Copy link
Member

Let's set this aside for now. This is basically discussing a new rule (prefer trying and failing rather than assert.threw), which we can easily update to later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants