Skip to content

Commit

Permalink
[Code Coverage] : 🤖 TEST: for lib/resolvers/group_chat_query/groupCha…
Browse files Browse the repository at this point in the history
…ts.jsGroup (#710)

* Test : lib/resolvers/group_chat_query/groupChatMessages.js

* Add Test  : Added Valid JSON Check

* 🤖 TEST:    for  lib/resolvers/group_chat_query/groupChats.js

* 🤖 TEST:    for  lib/resolvers/group_chat_query/groupChats.js

* 🤖 TEST: Imrpoved Descriptions

* removed the extra file
  • Loading branch information
SiddheshKukade authored Jun 8, 2022
1 parent ad440ba commit 11ead17
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/resolvers/group_chat_query/groupChats.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const database = require('../../../db');
const groupChat = require('../../../lib/resolvers/group_chat_query/groupChats');

beforeAll(async () => {
require('dotenv').config(); // pull env variables from .env file
await database.connect();
});

afterAll(async () => {
database.disconnect();
});

describe('tests for lib/resolvers/group_chat_query/groupChats.js', () => {
test('Should return a JSON response (getting the group chat messages from the database)', async () => {
const res = await groupChat();
expect(typeof res).toBe('object');
});
test('groupChat Produces metadata object that can be parsed to valid JSON', async () => {
const temp = await groupChat();
const parseJson = () => {
const json = JSON.stringify(temp);
JSON.parse(json);
};
expect(parseJson).not.toThrow();
});
});

0 comments on commit 11ead17

Please sign in to comment.