From 6e5e15097e794a3eea9093bb86b13f69fdc8cc4a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:25:03 +0200 Subject: [PATCH] NotificationList.vue with default as afunction tested --- .../NotificationList/NotificationList.spec.js | 19 +++++++++++++++++++ .../NotificationList/NotificationList.vue | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/webapp/components/NotificationList/NotificationList.spec.js b/webapp/components/NotificationList/NotificationList.spec.js index ce20a2765..219c1fdbb 100644 --- a/webapp/components/NotificationList/NotificationList.spec.js +++ b/webapp/components/NotificationList/NotificationList.spec.js @@ -81,4 +81,23 @@ describe('NotificationList.vue', () => { }) }) }) + + describe('shallowMount with no notifications', () => { + const Wrapper = () => { + return shallowMount(NotificationList, { + propsData: {}, + mocks, + store, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders Notification.vue zero times', () => { + expect(wrapper.findAll(Notification)).toHaveLength(0) + }) + }) }) diff --git a/webapp/components/NotificationList/NotificationList.vue b/webapp/components/NotificationList/NotificationList.vue index 877133f39..fd2d6366c 100644 --- a/webapp/components/NotificationList/NotificationList.vue +++ b/webapp/components/NotificationList/NotificationList.vue @@ -20,7 +20,7 @@ export default { props: { notifications: { type: Array, - default: [], + default: () => [], }, }, methods: {