From b2d6d91ddf4a530331a2dbcf25e2e3269b99246d Mon Sep 17 00:00:00 2001 From: Daniel Passos Date: Fri, 21 Jun 2019 09:47:41 -0300 Subject: [PATCH] Add push unregister test --- packages/push/test/PushRegistrationTest.ts | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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); + } + }); + }); });