status_parses.spec.js 1.1 KB

1234567891011121314151617
  1. const example = '<div class="status-content">@<a href="https://sealion.club/user/4" class="h-card mention" title="dewoo">dwmatiz</a> <a href="https://social.heldscal.la/file/3deb764ada10ce64a61b7a070b75dac45f86d2d5bf213bf18873da71d8714d86.png" title="https://social.heldscal.la/file/3deb764ada10ce64a61b7a070b75dac45f86d2d5bf213bf18873da71d8714d86.png" class="attachment" id="attachment-159853" rel="nofollow external">https://social.heldscal.la/attachment/159853</a></div>'
  2. import { removeAttachmentLinks } from '../../../../../src/services/status_parser/status_parser.js'
  3. describe('statusParser.removeAttachmentLinks', () => {
  4. const exampleWithoutAttachmentLinks = '<div class="status-content">@<a href="https://sealion.club/user/4" class="h-card mention" title="dewoo">dwmatiz</a> </div>'
  5. it('removes attachment links', () => {
  6. const parsed = removeAttachmentLinks(example)
  7. expect(parsed).to.eql(exampleWithoutAttachmentLinks)
  8. })
  9. it('works when the class is empty', () => {
  10. const parsed = removeAttachmentLinks('<a></a>')
  11. expect(parsed).to.eql('<a></a>')
  12. })
  13. })