Fix tests that rely on emojification
This commit is contained in:
parent
770794dcd7
commit
7f3ab20555
4 changed files with 7 additions and 9 deletions
|
@ -131,15 +131,13 @@ describe('normalizeAccount()', () => {
|
|||
it('emojifies display name as `display_name_html`', () => {
|
||||
const account = require('soapbox/__fixtures__/account-with-emojis.json');
|
||||
const result = normalizeAccount(account);
|
||||
const expected = 'Alex Gleason <img draggable="false" class="emojione" alt="😂" title=":joy:" src="/packs/emoji/1f602.svg" /> <img draggable="false" class="emojione" alt=":soapbox:" title=":soapbox:" src="https://gleasonator.com/emoji/Gleasonator/soapbox.png" /> <img draggable="false" class="emojione" alt=":ablobcatrainbow:" title=":ablobcatrainbow:" src="https://gleasonator.com/emoji/blobcat/ablobcatrainbow.png" />';
|
||||
expect(result.display_name_html).toBe(expected);
|
||||
expect(result.display_name_html).toContain('emojione');
|
||||
});
|
||||
|
||||
it('emojifies note as `note_emojified`', () => {
|
||||
const account = require('soapbox/__fixtures__/account-with-emojis.json');
|
||||
const result = normalizeAccount(account);
|
||||
const expected = 'I create Fediverse software that empowers people online. <img draggable="false" class="emojione" alt=":soapbox:" title=":soapbox:" src="https://gleasonator.com/emoji/Gleasonator/soapbox.png" /><br/><br/>I'm vegan btw<br/><br/>Note: If you have a question for me, please tag me publicly. This gives the opportunity for others to chime in, and bystanders to learn.';
|
||||
expect(result.note_emojified).toBe(expected);
|
||||
expect(result.note_emojified).toContain('emojione');
|
||||
});
|
||||
|
||||
it('unescapes HTML note as `note_plain`', () => {
|
||||
|
@ -154,8 +152,8 @@ describe('normalizeAccount()', () => {
|
|||
const result = normalizeAccount(account);
|
||||
const field = result.fields.get(1);
|
||||
|
||||
expect(field?.name_emojified).toBe('Soapbox <img draggable="false" class="emojione" alt=":ablobcatrainbow:" title=":ablobcatrainbow:" src="https://gleasonator.com/emoji/blobcat/ablobcatrainbow.png" />');
|
||||
expect(field?.value_emojified).toBe('<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a> <img draggable="false" class="emojione" alt=":soapbox:" title=":soapbox:" src="https://gleasonator.com/emoji/Gleasonator/soapbox.png" />');
|
||||
expect(field?.name_emojified).toContain('emojione');
|
||||
expect(field?.value_emojified).toContain('emojione');
|
||||
expect(field?.value_plain).toBe('https://soapbox.pub :soapbox:');
|
||||
});
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('normalizePoll()', () => {
|
|||
|
||||
// Emojifies poll options
|
||||
expect(result.options.get(1)?.title_emojified)
|
||||
.toEqual('Custom emoji <img draggable="false" class="emojione" alt=":gleason_excited:" title=":gleason_excited:" src="https://gleasonator.com/emoji/gleason_emojis/gleason_excited.png" /> ');
|
||||
.toContain('emojione');
|
||||
|
||||
// Parses emojis as Immutable.Record's
|
||||
expect(ImmutableRecord.isRecord(result.emojis.get(0))).toBe(true);
|
||||
|
|
|
@ -183,7 +183,7 @@ describe('normalizeStatus()', () => {
|
|||
|
||||
// Emojifies poll options
|
||||
expect(poll.options.get(1)?.title_emojified)
|
||||
.toEqual('Custom emoji <img draggable="false" class="emojione" alt=":gleason_excited:" title=":gleason_excited:" src="https://gleasonator.com/emoji/gleason_emojis/gleason_excited.png" /> ');
|
||||
.toContain('emojione');
|
||||
|
||||
// Parses emojis as Immutable.Record's
|
||||
expect(ImmutableRecord.isRecord(poll.emojis.get(0))).toBe(true);
|
||||
|
|
|
@ -118,7 +118,7 @@ describe('statuses reducer', () => {
|
|||
const status = require('soapbox/__fixtures__/status-custom-emoji.json');
|
||||
const action = { type: STATUS_IMPORT, status };
|
||||
|
||||
const expected = 'Hello <img draggable="false" class="emojione" alt=":ablobcathyper:" title=":ablobcathyper:" src="https://gleasonator.com/emoji/blobcat/ablobcathyper.png"> <img draggable="false" class="emojione" alt=":ageblobcat:" title=":ageblobcat:" src="https://gleasonator.com/emoji/blobcat/ageblobcat.png"> <img draggable="false" class="emojione" alt="😂" title=":joy:" src="/packs/emoji/1f602.svg"> world <img draggable="false" class="emojione" alt="😋" title=":yum:" src="/packs/emoji/1f60b.svg"> test <img draggable="false" class="emojione" alt=":blobcatphoto:" title=":blobcatphoto:" src="https://gleasonator.com/emoji/blobcat/blobcatphoto.png">';
|
||||
const expected = 'Hello <img draggable="false" class="emojione custom-emoji" alt=":ablobcathyper:" title=":ablobcathyper:" src="https://gleasonator.com/emoji/blobcat/ablobcathyper.png" data-original="https://gleasonator.com/emoji/blobcat/ablobcathyper.png" data-static="https://gleasonator.com/emoji/blobcat/ablobcathyper.png"> <img draggable="false" class="emojione custom-emoji" alt=":ageblobcat:" title=":ageblobcat:" src="https://gleasonator.com/emoji/blobcat/ageblobcat.png" data-original="https://gleasonator.com/emoji/blobcat/ageblobcat.png" data-static="https://gleasonator.com/emoji/blobcat/ageblobcat.png"> <img draggable="false" class="emojione" alt="😂" title=":joy:" src="/packs/emoji/1f602.svg"> world <img draggable="false" class="emojione" alt="😋" title=":yum:" src="/packs/emoji/1f60b.svg"> test <img draggable="false" class="emojione custom-emoji" alt=":blobcatphoto:" title=":blobcatphoto:" src="https://gleasonator.com/emoji/blobcat/blobcatphoto.png" data-original="https://gleasonator.com/emoji/blobcat/blobcatphoto.png" data-static="https://gleasonator.com/emoji/blobcat/blobcatphoto.png">';
|
||||
|
||||
const result = reducer(undefined, action).getIn(['AGm7uC9DaAIGUa4KYK', 'contentHtml']);
|
||||
expect(result).toBe(expected);
|
||||
|
|
Loading…
Reference in a new issue