From f2f98214cdd43792825f6a18a50cc1cd15c880b7 Mon Sep 17 00:00:00 2001 From: ksraj123 Date: Wed, 29 Jul 2020 13:40:39 +0530 Subject: [PATCH] fixes issues in prposal route --- app/models/Proposal.js | 3 +++ test/proposal.test.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/Proposal.js b/app/models/Proposal.js index 4a1f97b..813be0c 100644 --- a/app/models/Proposal.js +++ b/app/models/Proposal.js @@ -7,6 +7,9 @@ const proposalSchema = new Schema( type: String, required: true }, + organization: { + type: String + }, content: { type: String, required: true diff --git a/test/proposal.test.js b/test/proposal.test.js index 1098d9f..5a0b70d 100644 --- a/test/proposal.test.js +++ b/test/proposal.test.js @@ -1,4 +1,4 @@ -const app = require('../app') +const app = require('../app').app const mongoose = require('mongoose') const jwt = require('jsonwebtoken') const HttpStatus = require('http-status-codes') @@ -195,3 +195,12 @@ test('Should return the proposal by the given Id', async (done) => { done() }) + +afterAll(async () => { + // avoid jest open handle error + await new Promise((resolve) => setTimeout(() => resolve(), 500)) + // close server + await server.close() + // Closing the DB connection allows Jest to exit successfully. + await mongoose.connection.close() +})