Skip to content

Commit

Permalink
Merge pull request ubiquity-os-marketplace#19 from gentlementlegen/fi…
Browse files Browse the repository at this point in the history
…x/special-characters-escaping

chore: tests for special characters
  • Loading branch information
gentlementlegen authored May 16, 2024
2 parents ecd6281 + f541345 commit 142ad6d
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/__mocks__/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ export const handlers = [
}
return HttpResponse.json(user);
}),
http.post("https://api.github.com/app/installations/48381972/access_tokens", () => {
return HttpResponse.json({});
}),
];
29 changes: 28 additions & 1 deletion tests/__mocks__/results/content-evaluator-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
]
},
"0x4007": {
"total": 33.44,
"total": 60.24,
"userId": 4975670,
"comments": [
{
Expand Down Expand Up @@ -347,6 +347,33 @@
"reward": 0.96,
"relevance": 0.8
}
},
{
"content": "I am quoting some code! <task-lists sortable=\"\"> <table class=\"d-block user-select-contain\" data-paste-markdown-skip=\"\"> <tbody class=\"d-block\"> <tr class=\"d-block\"> <td class=\"d-block comment-body markdown-body js-comment-body\"> <details open=\"\"> <summary> <b> <h3 dir=\"auto\"> <a href=\"https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIyODAwMDAwMDAwMDAwMDAwMDAifSwibm9uY2UiOiIzODYyOTY0MDg5ODkzNzI1MzYwMjc5MjAyNzMxMjA2NzgzMTY0NDI2OTA3NTY2NTIxNzQ0NDkyNjQ1MTA0NTIyODU4Nzk1MjgzMDk0NCIsImRlYWRsaW5lIjoiNTc4OTYwNDQ2MTg2NTgwOTc3MTE3ODU0OTI1MDQzNDM5NTM5MjY2MzQ5OTIzMzI4MjAyODIwMTk3Mjg3OTIwMDM5NTY1NjQ4MTk5NjcifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHgwZkMxYjkwOWJhOTI2NUE4NDZiODJDRjRDRTM1MmZjM2U3RWVCMkVEIiwicmVxdWVzdGVkQW1vdW50IjoiMjgwMDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHg0NENhMTVEYjEwMWZEMWMxOTQ0NjdEYjZBRjBjNjdDNkJiRjRBQjUxIiwic2lnbmF0dXJlIjoiMHhiMzE4MmIwNjJiMDJmMjEwZTIzN2UzODQxMDNmNGE4YTUwMDNjMmYyODhiMDY5Nzg4MTY1ZDkwOWY4ODZmYTMzNTM4MjJlYjA5MGI1ODdjMWFiNWFiOTNjNTVlZDhkOTdiYzM3YzBmZjZlZDJhMWRkM2U1NjQ4M2JlMzk5MWIwNTFjIiwibmV0d29ya0lkIjoxMDB9XQ==\" rel=\"nofollow\"> [ 0.28 WXDAI ] </a> </h3> <h6 dir=\"auto\"> <a class=\"user-mention notranslate\" data-hovercard-type=\"user\" data-hovercard-url=\"/users/gentlementlegen/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\" href=\"https://github.com/gentlementlegen\">@gentlementlegen</a> </h6> </b> </summary> <h6 dir=\"auto\">Contributions Overview</h6> <table role=\"table\"> <thead> <tr> <th>View</th> <th>Contribution</th> <th>Count</th> <th>Reward</th> </tr> </thead> <tbody> <tr> <td>Issue</td> <td>Specification</td> <td>1</td> <td>0.1</td> </tr> <tr> <td>Issue</td> <td>Comment</td> <td>7</td> <td>0.18</td> </tr> </tbody> </table> <h6 dir=\"auto\">Conversation Incentives</h6> <table role=\"table\"> <thead> <tr> <th>Comment</th> <th>Formatting</th> <th>Relevance</th> <th>Reward</th> </tr> </thead> <tbody> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">issue 2</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 2 score: 1 </pre> </details> </td> <td>0.5</td> <td>0.1</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076607863\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">test</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076628437\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">```hey```</a> </h6> </td> <td> <details> <summary> 0.4 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 code: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076628605\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">``` heyo ```</a> </h6> </td> <td> <details> <summary> 0.4 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 code: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076632071\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">gr</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076960228\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">te</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076964178\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">fwe</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076972544\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">te</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>0.9</td> <td>0.18</td> </tr> </tbody> </table> </details> </td> </tr> </tbody> </table> </task-lists> [😂](https://emojipedia.org/face-with-tears-of-joy) - elem 1 - elem 2",
"url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678",
"type": "REVIEW|COLLABORATOR|COMMENTED",
"score": {
"formatting": {
"content": {
"p": {
"count": 332,
"score": 1
},
"code": {
"count": 2,
"score": 1
},
"a": {
"count": 1,
"score": 1
}
},
"wordValue": 0.1,
"formattingMultiplier": 1
},
"reward": 26.8,
"relevance": 0.8
}
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions tests/__mocks__/results/data-purge-result.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
"content": "I was editing this right now but was too slow to push.",
"url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196677",
"type": "REVIEW|COLLABORATOR|COMMENTED"
},
{
"content": "I am quoting some code! <task-lists sortable=\"\"> <table class=\"d-block user-select-contain\" data-paste-markdown-skip=\"\"> <tbody class=\"d-block\"> <tr class=\"d-block\"> <td class=\"d-block comment-body markdown-body js-comment-body\"> <details open=\"\"> <summary> <b> <h3 dir=\"auto\"> <a href=\"https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIyODAwMDAwMDAwMDAwMDAwMDAifSwibm9uY2UiOiIzODYyOTY0MDg5ODkzNzI1MzYwMjc5MjAyNzMxMjA2NzgzMTY0NDI2OTA3NTY2NTIxNzQ0NDkyNjQ1MTA0NTIyODU4Nzk1MjgzMDk0NCIsImRlYWRsaW5lIjoiNTc4OTYwNDQ2MTg2NTgwOTc3MTE3ODU0OTI1MDQzNDM5NTM5MjY2MzQ5OTIzMzI4MjAyODIwMTk3Mjg3OTIwMDM5NTY1NjQ4MTk5NjcifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHgwZkMxYjkwOWJhOTI2NUE4NDZiODJDRjRDRTM1MmZjM2U3RWVCMkVEIiwicmVxdWVzdGVkQW1vdW50IjoiMjgwMDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHg0NENhMTVEYjEwMWZEMWMxOTQ0NjdEYjZBRjBjNjdDNkJiRjRBQjUxIiwic2lnbmF0dXJlIjoiMHhiMzE4MmIwNjJiMDJmMjEwZTIzN2UzODQxMDNmNGE4YTUwMDNjMmYyODhiMDY5Nzg4MTY1ZDkwOWY4ODZmYTMzNTM4MjJlYjA5MGI1ODdjMWFiNWFiOTNjNTVlZDhkOTdiYzM3YzBmZjZlZDJhMWRkM2U1NjQ4M2JlMzk5MWIwNTFjIiwibmV0d29ya0lkIjoxMDB9XQ==\" rel=\"nofollow\"> [ 0.28 WXDAI ] </a> </h3> <h6 dir=\"auto\"> <a class=\"user-mention notranslate\" data-hovercard-type=\"user\" data-hovercard-url=\"/users/gentlementlegen/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\" href=\"https://github.com/gentlementlegen\">@gentlementlegen</a> </h6> </b> </summary> <h6 dir=\"auto\">Contributions Overview</h6> <table role=\"table\"> <thead> <tr> <th>View</th> <th>Contribution</th> <th>Count</th> <th>Reward</th> </tr> </thead> <tbody> <tr> <td>Issue</td> <td>Specification</td> <td>1</td> <td>0.1</td> </tr> <tr> <td>Issue</td> <td>Comment</td> <td>7</td> <td>0.18</td> </tr> </tbody> </table> <h6 dir=\"auto\">Conversation Incentives</h6> <table role=\"table\"> <thead> <tr> <th>Comment</th> <th>Formatting</th> <th>Relevance</th> <th>Reward</th> </tr> </thead> <tbody> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">issue 2</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 2 score: 1 </pre> </details> </td> <td>0.5</td> <td>0.1</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076607863\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">test</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076628437\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">```hey```</a> </h6> </td> <td> <details> <summary> 0.4 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 code: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076628605\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">``` heyo ```</a> </h6> </td> <td> <details> <summary> 0.4 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 code: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076632071\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">gr</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076960228\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">te</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076964178\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">fwe</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>-</td> <td>-</td> </tr> <tr> <td> <h6 dir=\"auto\"> <a href=\"https://github.com/Meniole/bot/issues/3#issuecomment-2076972544\" data-hovercard-type=\"issue\" data-hovercard-url=\"/Meniole/bot/issues/3/hovercard\">te</a> </h6> </td> <td> <details> <summary> 0.2 </summary> <pre class=\"notranslate\">p: count: 1 score: 1 </pre> </details> </td> <td>0.9</td> <td>0.18</td> </tr> </tbody> </table> </details> </td> </tr> </tbody> </table> </task-lists> [😂](https://emojipedia.org/face-with-tears-of-joy) - elem 1 - elem 2",
"url": "https://github.com/ubiquibot/comment-incentives/pull/25#issuecomment-1949196678",
"type": "REVIEW|COLLABORATOR|COMMENTED"
}
]
},
Expand Down
Loading

1 comment on commit 142ad6d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines Statements Branches Functions
Coverage: 79%
79.3% (341/430) 67.85% (133/196) 81.52% (75/92)

JUnit

Tests Skipped Failures Errors Time
22 0 💤 2 ❌ 0 🔥 8.263s ⏱️

Please sign in to comment.