diff --git a/packages/push/test/PushRegistrationTest.ts b/packages/push/test/PushRegistrationTest.ts index 3ed197a2..53c1caa8 100644 --- a/packages/push/test/PushRegistrationTest.ts +++ b/packages/push/test/PushRegistrationTest.ts @@ -53,4 +53,27 @@ describe("Registration tests", () => { } }); }); + + describe("#unregister", async () => { + it("should fail to unregister in push server", async () => { + try { + await registration.unregister(); + assert.fail(); + } catch (_) { + return "ok"; + } + }); + + it("should unregister in push server", async function() { + // in CI environment this test sometimes fails because of the default timeout 2s + // increase timeout to 10s + this.timeout(10000); + try { + global.window.localStorage = { getItem: () => "deviceToken" }; + await registration.unregister(); + } catch (error) { + assert.fail(error); + } + }); + }); });