mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-27 02:24:03 -05:00
Add some tests
This commit is contained in:
parent
6a900d4c8b
commit
4a167ae3ca
@ -35,7 +35,7 @@ RSpec.describe AdvancedTextFormatter do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'given a block code' do
|
context 'given a block code' do
|
||||||
let(:text) { "test\n\n```\nint main(void) {\n return 0;\n}\n```\n" }
|
let(:text) { "test\n\n```\nint main(void) {\n return 0; // https://joinmastodon.org/foo\n}\n```\n" }
|
||||||
|
|
||||||
it 'formats code using <pre> and <code>' do
|
it 'formats code using <pre> and <code>' do
|
||||||
is_expected.to include '<pre><code>int main'
|
is_expected.to include '<pre><code>int main'
|
||||||
@ -44,13 +44,17 @@ RSpec.describe AdvancedTextFormatter do
|
|||||||
it 'does not strip leading spaces' do
|
it 'does not strip leading spaces' do
|
||||||
is_expected.to include '> return 0'
|
is_expected.to include '> return 0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not format links' do
|
||||||
|
is_expected.to include 'return 0; // https://joinmastodon.org/foo'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'given some quote' do
|
context 'given a link in inline code using backticks' do
|
||||||
let(:text) { "> foo\n\nbar" }
|
let(:text) { 'test `https://foo.bar/bar` bar' }
|
||||||
|
|
||||||
it 'formats code using <code>' do
|
it 'does not rewrite the link' do
|
||||||
is_expected.to include '<blockquote><p>foo</p></blockquote>'
|
is_expected.to include 'test <code>https://foo.bar/bar</code> bar'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user