Skip to content

Commit

Permalink
Fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicteh1 committed Sep 21, 2024
1 parent 321195d commit 35e112f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/categories/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ module.exports = function (Categories) {
// Remove HTML tags and get first 100 characteres of content to preview
const strippedContent = mainPosts.map((post) => {
const plainText = post.content.replace(/<[^>]*>/g, '').trim();
if (plainText.length <= 100){
if (plainText.length <= 100) {
return plainText.substring(0, 100);
}else{
return plainText.substring(0, 100) + '...';
}

return `${plainText.substring(0, 100)}...`;
});
topicsData = topicsData.map((topic, index) => {
//add new attribute to topics object
// Add new attribute to topics object
topic.content = strippedContent[index];
return topic;
});
Expand Down
3 changes: 1 addition & 2 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,8 @@ describe('API', async () => {
// Don't proceed with type-check if the value could possibly be unset (nullable: true, in spec)
if (response[prop] === null || schema[prop].nullable === true) {
return;
} else {
assert(response.hasOwnProperty(prop), `"${prop}" is a required property (path: ${method} ${path}, context: ${context})`);
}
assert(response.hasOwnProperty(prop), `"${prop}" is a required property (path: ${method} ${path}, context: ${context})`);

// Therefore, if the value is actually null, that's a problem (nullable is probably missing)
assert(response[prop] !== null, `"${prop}" was null, but schema does not specify it to be a nullable property (path: ${method} ${path}, context: ${context})`);
Expand Down

0 comments on commit 35e112f

Please sign in to comment.