From 341cc363d42a15d03aab62d152c44cb9bc96cfbc Mon Sep 17 00:00:00 2001
From: Mark Florian <mflorian@gitlab.com>
Date: Wed, 25 Aug 2021 15:02:43 +0100
Subject: [PATCH] Make test pass for the right reason

Previously, the `nextTick` wasn't awaited, which meant that the on-call
schedules list wasn't rendered anyway.

This also makes sure the previous wrapper is destroyed before creating
a new one for this test.
---
 spec/frontend/members/components/modals/leave_modal_spec.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/spec/frontend/members/components/modals/leave_modal_spec.js b/spec/frontend/members/components/modals/leave_modal_spec.js
index 56aab4c532b42..1dc913e5c7887 100644
--- a/spec/frontend/members/components/modals/leave_modal_spec.js
+++ b/spec/frontend/members/components/modals/leave_modal_spec.js
@@ -99,10 +99,14 @@ describe('LeaveModal', () => {
       });
     });
 
-    it("does NOT display oncall schedules list when member's user is NOT a part of on-call schedules ", () => {
+    it("does NOT display oncall schedules list when member's user is NOT a part of on-call schedules ", async () => {
+      wrapper.destroy();
+
       const memberWithoutOncallSchedules = cloneDeep(member);
       delete memberWithoutOncallSchedules.user.oncallSchedules;
       createComponent({ member: memberWithoutOncallSchedules });
+      await nextTick();
+
       expect(findOncallSchedulesList().exists()).toBe(false);
     });
   });
-- 
GitLab