From 69015be2f6a3ca579827179326461c07ed8b891d Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Tue, 20 Feb 2024 18:12:11 -0600 Subject: [PATCH] Add test coverage for sample widgets --- .../widgets/RenderAllWidgetsTest.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/RenderAllWidgetsTest.java diff --git a/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/RenderAllWidgetsTest.java b/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/RenderAllWidgetsTest.java new file mode 100644 index 00000000..42d19bf4 --- /dev/null +++ b/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/RenderAllWidgetsTest.java @@ -0,0 +1,63 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2022. Kingsrook, LLC + * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States + * contact@kingsrook.com + * https://github.com/Kingsrook/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.kingsrook.sampleapp.dashboard.widgets; + + +import com.kingsrook.qqq.backend.core.actions.dashboard.RenderWidgetAction; +import com.kingsrook.qqq.backend.core.context.QContext; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput; +import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput; +import com.kingsrook.qqq.backend.core.model.metadata.QInstance; +import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface; +import com.kingsrook.qqq.backend.core.model.session.QSession; +import com.kingsrook.sampleapp.metadata.SampleMetaDataProvider; +import org.junit.jupiter.api.Test; + + +/******************************************************************************* + ** Unit test for PersonsByCreateDateBarChart + *******************************************************************************/ +class RenderAllWidgetsTest +{ + + /******************************************************************************* + ** + *******************************************************************************/ + @Test + void test() throws QException + { + QInstance qInstance = SampleMetaDataProvider.defineInstance(); + QContext.init(qInstance, new QSession()); + + //////////////////////////////////////////////////////////////// + // make sure no widgets throw - and we get some code coverage // + //////////////////////////////////////////////////////////////// + for(QWidgetMetaDataInterface widget : qInstance.getWidgets().values()) + { + RenderWidgetInput input = new RenderWidgetInput(); + input.setWidgetMetaData(widget); + RenderWidgetOutput output = new RenderWidgetAction().execute(input); + } + } + +}