From eb21642103c32cf5833f218eacc6d360bd59ee42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sun, 30 Jul 2017 21:35:01 -0700 Subject: [PATCH] Add reload tests --- assets/static/unsee.test.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/assets/static/unsee.test.js b/assets/static/unsee.test.js index 1f70adc15..cb84b8fab 100644 --- a/assets/static/unsee.test.js +++ b/assets/static/unsee.test.js @@ -48,14 +48,29 @@ if (alertsServer) { require("bootstrap/js/tooltip.js"); require("bootstrap/js/modal.js"); require("bootstrap/js/popover.js"); - unsee.onReady(); alertsServer.start(); + + unsee.onReady(); unsee.triggerReload(); jest.runOnlyPendingTimers(); - alertsServer.stop(); - // we should have 2 alerts expect(grid.items().length).toBe(2); expect($("#alert-count").text()).toBe("2"); + + unsee.triggerReload(); + jest.runOnlyPendingTimers(); + // we should still have 2 alerts + expect(grid.items().length).toBe(2); + expect($("#alert-count").text()).toBe("2"); + + // clear grid and update again + grid.clear(); + unsee.triggerReload(); + jest.runOnlyPendingTimers(); + // we should still have 2 alerts + expect(grid.items().length).toBe(2); + expect($("#alert-count").text()).toBe("2"); + + alertsServer.stop(); }); }