Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 2s
131 lines
6.0 KiB
TypeScript
131 lines
6.0 KiB
TypeScript
import { parse } from '../src';
|
|
import {
|
|
italic,
|
|
paragraph,
|
|
plain,
|
|
strike,
|
|
bold,
|
|
emoji,
|
|
link,
|
|
bigEmoji,
|
|
emojiUnicode,
|
|
mentionChannel,
|
|
mentionUser,
|
|
inlineCode,
|
|
} from './helpers';
|
|
|
|
test.each([
|
|
['_:smile:_', [paragraph([italic([emoji('smile')])])]],
|
|
['_:slight_smile:_', [paragraph([italic([emoji('slight_smile')])])]],
|
|
['_test :smile: test_', [paragraph([italic([plain('test '), emoji('smile'), plain(' test')])])]],
|
|
['_test :slight_smile: test_', [paragraph([italic([plain('test '), emoji('slight_smile'), plain(' test')])])]],
|
|
['_😀_', [paragraph([italic([emojiUnicode('😀')])])]],
|
|
['_test 😀_', [paragraph([italic([plain('test '), emojiUnicode('😀')])])]],
|
|
['_test @guilherme.gazzo test_', [paragraph([italic([plain('test '), mentionUser('guilherme.gazzo'), plain(' test')])])]],
|
|
['_test #GENERAL test_', [paragraph([italic([plain('test '), mentionChannel('GENERAL'), plain(' test')])])]],
|
|
[
|
|
'_[A brand new Gist](https://gist.github.com/24dddfa97bef58f46ac2ce0f80c58ba4)_',
|
|
[paragraph([italic([link('https://gist.github.com/24dddfa97bef58f46ac2ce0f80c58ba4', [plain('A brand new Gist')])])])],
|
|
],
|
|
['__italic__', [paragraph([italic([plain('italic')])])]],
|
|
['__italic__non', [paragraph([plain('__italic__non')])]],
|
|
['__test__test__', [paragraph([plain('__test__test__')])]],
|
|
['pre__italic__post', [paragraph([plain('pre__italic__post')])]],
|
|
[' pre__italic__post', [paragraph([plain(' pre__italic__post')])]],
|
|
[' pre__**~~boldstrikeitalic~~**__post ', [paragraph([plain(' pre__'), bold([strike([plain('boldstrikeitalic')])]), plain('__post ')])]],
|
|
['__', [paragraph([plain('__')])]],
|
|
['_ _', [paragraph([plain('_ _')])]],
|
|
['__ _', [paragraph([plain('__ _')])]],
|
|
['__ __', [paragraph([plain('__ __')])]],
|
|
['_ Hello_', [paragraph([italic([plain(' Hello')])])]],
|
|
['_Hello _', [paragraph([italic([plain('Hello ')])])]],
|
|
[':custom_emoji_case:', [bigEmoji([emoji('custom_emoji_case')])]],
|
|
['_Hel lo_', [paragraph([italic([plain('Hel lo')])])]],
|
|
['_Hello_', [paragraph([italic([plain('Hello')])])]],
|
|
['__Hello__', [paragraph([italic([plain('Hello')])])]],
|
|
['__Hello_', [paragraph([plain('_'), italic([plain('Hello')])])]],
|
|
['_Hello__', [paragraph([italic([plain('Hello')]), plain('_')])]],
|
|
['_Hello', [paragraph([plain('_Hello')])]],
|
|
['Hello_', [paragraph([plain('Hello_')])]],
|
|
['He_llo', [paragraph([plain('He_llo')])]],
|
|
['___Hello___', [paragraph([plain('_'), italic([plain('Hello')]), plain('_')])]],
|
|
['___Hello__', [paragraph([plain('_'), italic([plain('Hello')])])]],
|
|
['_Hello_ this is dog', [paragraph([italic([plain('Hello')]), plain(` this is dog`)])]],
|
|
['Rocket cat says _Hello_', [paragraph([plain(`Rocket cat says `), italic([plain('Hello')])])]],
|
|
['He said _Hello_ to her', [paragraph([plain(`He said `), italic([plain('Hello')]), plain(` to her`)])]],
|
|
['__Hello__ this is dog', [paragraph([italic([plain('Hello')]), plain(` this is dog`)])]],
|
|
['Rocket cat says __Hello__', [paragraph([plain(`Rocket cat says `), italic([plain('Hello')])])]],
|
|
['He said __Hello__ to her', [paragraph([plain(`He said `), italic([plain('Hello')]), plain(` to her`)])]],
|
|
['text_hello_text', [paragraph([plain('text_hello_text')])]],
|
|
['_hello_text', [paragraph([plain('_hello_text')])]],
|
|
['text_hello_', [paragraph([plain('text_hello_')])]],
|
|
['_italic@test_', [paragraph([italic([plain('italic@test')])])]],
|
|
['_italic#test_', [paragraph([italic([plain('italic#test')])])]],
|
|
['paragraph@test__', [paragraph([plain('paragraph@test__')])]],
|
|
['_ @guilherme_gazzo_ _', [paragraph([italic([plain(' '), mentionUser('guilherme_gazzo_'), plain(' ')])])]],
|
|
['_ @guilherme.gazzo _', [paragraph([italic([plain(' '), mentionUser('guilherme.gazzo'), plain(' ')])])]],
|
|
['_9797.76_', [paragraph([italic([plain('9797.76')])])]],
|
|
['_3.14_', [paragraph([italic([plain('3.14')])])]],
|
|
['_example.com_', [paragraph([italic([plain('example.com')])])]],
|
|
['_rocket.chat_', [paragraph([italic([plain('rocket.chat')])])]],
|
|
['_example.com', [paragraph([plain('_example.com')])]],
|
|
[
|
|
'**reference link inside [emphasis with more [references](https://rocket.chat)](https://rocket.chat)**',
|
|
[
|
|
paragraph([
|
|
bold([
|
|
plain('reference link inside '),
|
|
link('https://rocket.chat', [plain('emphasis with more [references')]),
|
|
plain('](https://rocket.chat)'),
|
|
]),
|
|
]),
|
|
],
|
|
],
|
|
['_ouch_ouch', [paragraph([plain('_ouch_ouch')])]],
|
|
[`_@mention _gone`, [paragraph([plain('_'), mentionUser('mention'), plain(' _gone')])]],
|
|
['_nothing `should` be _gone', [paragraph([plain('_nothing '), inlineCode(plain('should')), plain(' be _gone')])]],
|
|
[
|
|
'**bold ~~and strike~~** **not bold ~~but strike** ~~ not strike~~',
|
|
[
|
|
paragraph([
|
|
bold([plain('bold '), strike([plain('and strike')])]),
|
|
plain(' **not bold '),
|
|
strike([plain('but strike** ')]),
|
|
plain(' not strike~~'),
|
|
]),
|
|
],
|
|
],
|
|
[
|
|
'**bold** **another bold** ~~strike~~ ~~another strike~~ **bold ~~and strike~~** **not bold ~~but strike** ~~ not strike~~',
|
|
[
|
|
paragraph([
|
|
bold([plain('bold')]),
|
|
plain(' '),
|
|
bold([plain('another bold')]),
|
|
plain(' '),
|
|
strike([plain('strike')]),
|
|
plain(' '),
|
|
strike([plain('another strike')]),
|
|
plain(' '),
|
|
bold([plain('bold '), strike([plain('and strike')])]),
|
|
plain(' **not bold '),
|
|
strike([plain('but strike** ')]),
|
|
plain(' not strike~~'),
|
|
]),
|
|
],
|
|
],
|
|
['some_snake_case_text and even_more', [paragraph([plain('some_snake_case_text and even_more')])]],
|
|
[
|
|
'some_snake_case_text and some __italic__ text',
|
|
[paragraph([plain('some_snake_case_text and some '), italic([plain('italic')]), plain(' text')])],
|
|
],
|
|
['some__double__snake__case__text and even_more', [paragraph([plain('some__double__snake__case__text and even_more')])]],
|
|
[
|
|
'some__double__snake__case__text and some __italic__ text',
|
|
[paragraph([plain('some__double__snake__case__text and some '), italic([plain('italic')]), plain(' text')])],
|
|
],
|
|
['something__ __and italic__', [paragraph([plain('something__ '), italic([plain('and italic')])])]],
|
|
])('parses %p', (input, output) => {
|
|
expect(parse(input, { emoticons: false })).toEqual(output);
|
|
});
|