From aa8331849084fe174020046cc38c19cc38feecea Mon Sep 17 00:00:00 2001 From: Lujain Date: Wed, 4 Oct 2023 20:04:35 +0300 Subject: [PATCH 1/2] Aded both tests that tests the functionality of the connection of isResolved --- test/topics.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/topics.js b/test/topics.js index ca71ad403..ff661fd7c 100644 --- a/test/topics.js +++ b/test/topics.js @@ -1253,21 +1253,33 @@ describe('Topic\'s', () => { }); }); - it('should load topic', (done) => { - request(`${nconf.get('url')}/topic/${topicData.slug}`, (err, response, body) => { + + + it('should load topic isResovled', (done) => { + db.setObjectField(`topic:${topicData.tid}`, 'isResolved', true); + done(); + }); + + + it('should load topic api data', (done) => { + request(`${nconf.get('url')}/api/topic/${topicData.tid}`, { json: true }, (err, response, body) => { assert.ifError(err); assert.equal(response.statusCode, 200); - assert(body); + assert.strictEqual(body._header.tags.meta.find(t => t.name === 'description').content, 'topic content'); + assert.strictEqual(body._header.tags.meta.find(t => t.property === 'og:description').content, 'topic content'); done(); }); }); - it('should load topic api data', (done) => { - request(`${nconf.get('url')}/api/topic/${topicData.slug}`, { json: true }, (err, response, body) => { + it('should load topic api data for isUrgent', (done) => { + request(`${nconf.get('url')}/api/topic/${topicData.tid}`, { json: true }, (err, response, body) => { assert.ifError(err); assert.equal(response.statusCode, 200); + //console.log(body._header); assert.strictEqual(body._header.tags.meta.find(t => t.name === 'description').content, 'topic content'); assert.strictEqual(body._header.tags.meta.find(t => t.property === 'og:description').content, 'topic content'); + assert.strictEqual(body.isResolved, 'true'); + done(); }); }); From fc22f4a9b7e9b2e3ef75e0ec308f85249a427f33 Mon Sep 17 00:00:00 2001 From: Lujain Date: Wed, 4 Oct 2023 20:05:19 +0300 Subject: [PATCH 2/2] Added the tests that test the functinality of making sure that the variable isreolve dis false by default --- test/topics.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/topics.js b/test/topics.js index ff661fd7c..c03cc606b 100644 --- a/test/topics.js +++ b/test/topics.js @@ -1253,7 +1253,18 @@ describe('Topic\'s', () => { }); }); - + it('should load topic', (done) => { + request(`${nconf.get('url')}/topic/${topicData.slug}`, (err, response, body) => { + assert.ifError(err); + assert.equal(response.statusCode, 200); + assert(body); + done(); + }); + }); + it('should check topic isResovled is false', (done) => { + assert.equal(topicData.isResolved, 'false'); + done(); + }); it('should load topic isResovled', (done) => { db.setObjectField(`topic:${topicData.tid}`, 'isResolved', true);