Skip to content

Commit

Permalink
msglist html: Type-check render-test.js and use example data.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Jul 28, 2020
1 parent 53abf6f commit e835828
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/webview/html/__tests__/render-test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/* @flow strict-local */
import messageTypingAsHtml from '../messageTypingAsHtml';
import * as eg from '../../../__tests__/lib/exampleData';

describe('typing', () => {
it('escapes values', () => {
expect(
messageTypingAsHtml('&<r', [
{
avatar_url: '&<av',
email: '&<e',
},
]),
).not.toContain('&<');
it('escapes &< (e.g., in `avatar_url` and `email`', () => {
const name = '&<name';
const user = {
...eg.makeUser({ name }),
avatar_url: `https://zulip.example.org/yo/avatar-${name}.png`,
email: `${name}@example.com`,
};

expect(messageTypingAsHtml('&<r', [user])).not.toContain('&<');
});
});

0 comments on commit e835828

Please sign in to comment.