The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/packages/message-parser/tests/spoilerBlock.test.ts

31 lines
639 B

import { parse } from '../src';
import { lineBreak, paragraph, plain, spoilerBlock } from './helpers';
describe('block spoiler parsing', () => {
test.each([
[
`||
line one
||`,
[spoilerBlock([paragraph([plain('line one')])])],
],
[
`||
line one
line two
||`,
[spoilerBlock([paragraph([plain('line one')]), paragraph([plain('line two')])])],
],
[
`before
||
hidden
||
after`,
[paragraph([plain('before')]), spoilerBlock([paragraph([plain('hidden')])]), lineBreak(), paragraph([plain('after')])],
],
])('parses block spoilers: %p', (input, output) => {
expect(parse(input)).toMatchObject(output);
});
});