|
41 | 41 | expect($message->getPayloadValue('text'))->toEqual("Laravel Notification\_Channels are awesome\!\nTelegram Notification Channel is fantastic :)\n");
|
42 | 42 | });
|
43 | 43 |
|
| 44 | +it('can escape markdown characters', function (string $input, string $expected) { |
| 45 | + expect(TelegramMessage::escapeMarkdown($input))->toEqual($expected); |
| 46 | +})->with([ |
| 47 | + 'special characters' => ['_*[]()~`>#+-=|{}.!', '\_\*\[\]\(\)\~\`\>\#\+\-\=\|\{\}\.\!'], |
| 48 | + 'a string with special characters' => ['Hello, _world_!', 'Hello, \_world\_\!'], |
| 49 | + 'a string with *' => ['*Hello, world!*', '\*Hello, world\!\*'], |
| 50 | + 'a string with []' => ['[Hello, world!]', '\[Hello, world\!\]'], |
| 51 | + 'a string with ()' => ['(Hello, world!)', '\(Hello, world\!\)'], |
| 52 | + 'a string with ~' => ['~Hello, world!~', '\~Hello, world\!\~'], |
| 53 | + 'a string with `' => ['`Hello, world!`', '\`Hello, world\!\`'], |
| 54 | + 'a string with >' => ['>Hello, world!', '\>Hello, world\!'], |
| 55 | + 'a string with #' => ['#Hello, world!', '\#Hello, world\!'], |
| 56 | + 'a string with +' => ['+Hello, world!', '\+Hello, world\!'], |
| 57 | + 'a string with -' => ['-Hello, world!', '\-Hello, world\!'], |
| 58 | + 'a string with =' => ['=Hello, world!', '\=Hello, world\!'], |
| 59 | + 'a string with |' => ['|Hello, world!', '\|Hello, world\!'], |
| 60 | + 'a string with {}' => ['{Hello, world!}', '\{Hello, world\!\}'], |
| 61 | + 'a string with .' => ['.Hello, world!', '\.Hello, world\!'], |
| 62 | + 'a string with !' => ['!Hello, world!', '\!Hello, world\!'], |
| 63 | +]); |
| 64 | + |
44 | 65 | it('can attach a view as the content', function () {
|
45 | 66 | View::addLocation(__DIR__.'/../TestSupport');
|
46 | 67 |
|
|
0 commit comments