import assert from 'assert' import { JSDOM } from 'jsdom' import { findLink, findTag, findAccount } from '../../src/renderer/utils/tootParser' describe('findLink', () => { context('Pleroma', () => { const doc = (new JSDOM(`

I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streaming update of Pleroma. But it contains a bug, so it is resolved in version 2.4.1.
https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1
#Whalebird

`)).window.document const target = doc.getElementById('link') it('should find', () => { const res = findLink(target) assert.strictEqual(res, 'https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1') }) }) }) describe('findTag', () => { context('Pleroma', () => { const doc = (new JSDOM(`

I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streaming update of Pleroma. But it contains a bug, so it is resolved in version 2.4.1.
https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1
#Whalebird

`)).window.document const target = doc.getElementById('tag') it('should find', () => { const res = findTag(target) assert.strictEqual(res, 'whalebird') }) }) context('Mastodon', () => { const doc = (new JSDOM(`

I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streaming update of Pleroma. But it contains a bug, so it is resolved in version 2.4.1.
https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1
#Whalebird

`)).window.document const target = doc.getElementById('tag') it('should find', () => { const res = findTag(target) assert.strictEqual(res, 'whalebird') }) }) }) describe('findAccount', () => { context('in Pleroma', () => { context('from Mastodon', () => { const doc = (new JSDOM(`

@h3_poteto hogehoge

`)).window.document const target = doc.getElementById('user') it('should find', () => { const res = findAccount(target) assert.strictEqual(res.username, '@h3_poteto') assert.strictEqual(res.acct, '@h3_poteto@social.mikutter.hachune.net') }) }) context('from Pleroma', () => { const doc = (new JSDOM(`

@h3_poteto hogehoge

`)).window.document const target = doc.getElementById('user') it('should find', () => { const res = findAccount(target) assert.strictEqual(res.username, '@h3poteto') assert.strictEqual(res.acct, '@h3poteto@pleroma.io') }) }) }) })