Skip to content

Commit

Permalink
Merge pull request #42 from CMU-313/label-backend-tests
Browse files Browse the repository at this point in the history
Added tests for answered by instructor feature backend
  • Loading branch information
ldlin1 authored Oct 11, 2024
2 parents 17ed96e + 7bb431c commit 14cabac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/topics/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ module.exports = function (Topics) {

// The following code was created with the assistance of ChatGPT.
async function addEventStartEnd(postData, set, reverse, topicData) {
console.log('Lucas Lin');

if (!postData.length) {
return;
}
Expand Down
9 changes: 9 additions & 0 deletions test/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,15 @@ describe('Topic\'s', () => {
assert.strictEqual(postsData[i].content, `topic reply ${i}`);
}
});

it('should check if post has answered by instructor field', async () => {
const topicData = await topics.getTopicData(tid);
const postsData = await topics.getTopicPosts(topicData, `tid:${tid}:posts`, 0, -1, topic.userId, false);
assert.strictEqual(postsData.length, 31);
for (let i = 0; i < 31; i++) {
assert.strictEqual(topicData.answered, undefined || 'true');
}
});
});
});

Expand Down

0 comments on commit 14cabac

Please sign in to comment.