From ba6ed7f9ff2a1d1e0608f752a901382156478901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sun, 2 Sep 2018 16:50:50 +0100 Subject: [PATCH] fix(tests): add test coverage for missed branches in AlertGrid --- ui/src/Components/Grid/AlertGrid/index.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/src/Components/Grid/AlertGrid/index.test.js b/ui/src/Components/Grid/AlertGrid/index.test.js index 4f3f7f3e6..8e7e5dd6e 100644 --- a/ui/src/Components/Grid/AlertGrid/index.test.js +++ b/ui/src/Components/Grid/AlertGrid/index.test.js @@ -89,6 +89,15 @@ describe("", () => { expect(instance.masonryComponentReference.ref.forcePack).toHaveBeenCalled(); }); + it("masonryRepack() doesn't crash when masonryComponentReference.ref=false`", () => { + const tree = ShallowAlertGrid(); + const instance = tree.instance(); + const repackSpy = jest.spyOn(instance, "masonryRepack"); + instance.masonryComponentReference.ref = false; + instance.componentDidUpdate(); + expect(repackSpy).toHaveBeenCalled(); + }); + it("calling storeMasonryRef() saves the ref in local store", () => { const tree = ShallowAlertGrid(); const instance = tree.instance();