buttonmen-dev / buttonmen

Buttonmen - an online dice game
Other
16 stars 24 forks source link

remove ajaxSetup from QUnit tests #1181

Open cgolubi1 opened 10 years ago

cgolubi1 commented 10 years ago

We believe it harms test isolation to use ajaxSetup { async: false; } as a mechanism for making parts of tests run synchronously. There are about 35 tests which still use this mechanism. Refactor those tests so they don't need to muck with ajaxSetup.

cgolubi1 commented 10 years ago

On #1104, we suggested using mocks to reduce some of the cases in which ajaxSetup is needed. In particular, where we need to manually call two functions in series during a test (e.g. when setting up a page and testing that form submission from that page works correctly), we should split such tests into two tests, one which mocks the form submission and tests that it is called correctly, and one which mocks or fakes the setup and tests the form submission function.

AdmiralJota commented 10 years ago

Since it might become inconvenient to get to my comments on the particular version of #1104 that I reviewed, I'll try to bring over some of the highlights of what I said there: