cleans up header notifications integration tests (PR #1642)

Step #3 of the refactoring done here: and here:

Adds a single, focused integration test that verifies proper wiring of all the notifications dropdown parts and removes all other notifications dropdown related integration tests (that are now redundant after all low-level parts have their own detailed unit tests).


You’ve signed the CLA, velesin. Thank you! This pull request is ready for review.

Awesome. Yesterday I did notice a warning for an ajax call that wasn’t stubbed/fixtured in the test environment. Does this PR fix it?

I’m not aware of it. This PR was intended as a clean up of test suite after completing the refactoring, if it fixes this warning it is only accidental. I’ll investigate it.

I’ve found this. This is not real AJAX request. In HeaderController test I wanted to verify that user’s unread notification count is reset and dropdown is opened only after ajax request finishes, not immediately after user click. So the test scenario is: simulate click -> nothing happens yet -> complete request (simulate sending response) -> now desired behaviours happen. Because Discourse.ajax fixtures are resolved immediately, they don’t allow such two-step test. Therefore I used fake sinon.server for this. However, sinon.server operates on a very low level (it doesn’t mock jQuery but low level XHR object) so for Discourse.ajax test helper it seems that the request hits real xhr and it raises an error (while in reality no real xhr request is made, it is mocked via sinon).

I don’t see any way to solve this problem with sinon.server. I’ll have to mock the request in some other way, on a bit higher level than xhr object. I’ll create a fix for this in a moment.