For all mocks on window (not navigator), you can use MocksHelper. See apps/sms/test/unit/utils_test.js for examples on how to use it. That will let you remove a lot of init lines and checks.