DEV: Fix a flaky/leaking test (PR #13468)

  • pretender wasn’t catching the request because it ran after this test finished
  • restore wasn’t needed, we do sinon.restore() after each test

The error was:

↪ Unit | Model | user::resolvedTimezone [✔]
↪ Unit | Utility | url::routeTo with prefixUnhandled request in test environment: /forum/u/chuck.json (PUT)
Error: Unhandled request in test environment: /forum/u/chuck.json (PUT)
    at Pretender.server.unhandledRequest (discourse/tests/setup-tests:173:15)
    at Pretender.handleRequest (pretender:400:14)
    at FakeRequest.send (pretender:169:21)
    at Object.send (jquery:10100:10)
    at Function.ajax (jquery:9683:15)
    at performAjax (discourse/app/lib/ajax:174:19)
    at eval (discourse/app/lib/ajax:183:11)
    at invokeCallback (ember:63104:17)
    at publish (ember:63087:9)
    at eval (ember:57463:16)
 [✘]

A minimal reproduction: http://localhost:3001/qunit?seed=3&testId=da76996b&testId=e52a53e7

GitHub

The title of this pull request changed from “DEV: Fix a flaky/leaking spec” to "DEV: Fix a flaky/leaking test

Hey I made this test! Looks good :slight_smile: