From 7d5babc922c8854910f81edf5ee4242497bd0ada Mon Sep 17 00:00:00 2001 From: Siddhesh Bhupendra Kuakde <65951872+SiddheshKukade@users.noreply.github.com> Date: Tue, 20 Sep 2022 00:35:56 +0530 Subject: [PATCH] Code Coverage : Tests for groups.js Fix #585 (#769) * Create groups.spec.js * Update groups.spec.js * Update getPlugins.spec.js --- tests/resolvers/group_query/groups.spec.js | 19 +++++++++++++++++++ .../resolvers/plugin_query/getPlugins.spec.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/resolvers/group_query/groups.spec.js diff --git a/tests/resolvers/group_query/groups.spec.js b/tests/resolvers/group_query/groups.spec.js new file mode 100644 index 0000000000..e72073e2c1 --- /dev/null +++ b/tests/resolvers/group_query/groups.spec.js @@ -0,0 +1,19 @@ +const database = require('../../../db'); +const groups = require('../../../lib/resolvers/group_query/groups'); +beforeAll(async () => { + require('dotenv').config(); // pull env variables from .env file + await database.connect(); +}); + +afterAll(() => { + database.disconnect(); +}); + +describe('Groups query testing for getting the lib/resolvers/group_query/groups.js', () => { + test('Testing groups Functions', async () => { + //on `groups.js` file we are only returning the data from database which can be some JSON or [] + //so we will just check if it's truthy value or not in the test. + const response = await groups(); + expect(response).toBeTruthy(); + }); +}); diff --git a/tests/resolvers/plugin_query/getPlugins.spec.js b/tests/resolvers/plugin_query/getPlugins.spec.js index a804878cce..29ae4d8396 100644 --- a/tests/resolvers/plugin_query/getPlugins.spec.js +++ b/tests/resolvers/plugin_query/getPlugins.spec.js @@ -10,7 +10,7 @@ afterAll(() => { database.disconnect(); }); -describe('Post query testing for post resolver', () => { +describe('Plugins query testing for getting the lib/resolvers/plugin_query/getPlugins.js', () => { test('Testing getPlugins Functions', async () => { const response = await getPlugins(); expect(response).toBeTruthy();