2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-17 19:21:20 +03:00

fix(html): add more tests

This commit is contained in:
Nikolay Kostyurin
2018-08-09 10:06:00 +02:00
parent 10f6ff9ff1
commit 4ebc512732
2 changed files with 19 additions and 3 deletions
+17 -1
View File
@@ -1,7 +1,7 @@
const render = require('../lib/index');
const parse = require('@bbob/parser');
const process = input => render(parse(input));
const process = (input, params) => render(parse(input), params);
describe('@bbob/html', () => {
test('render bbcode tag with single param as html tag', () => {
@@ -24,4 +24,20 @@ describe('@bbob/html', () => {
expect(process(input)).toBe(result);
});
test('strip tags', () => {
const input = '[url]https://ru.wikipedia.org[/url]';
const result = 'https://ru.wikipedia.org';
expect(process(input, { stripTags: true })).toBe(result);
});
test('array of nodes', () => {
const input = [
'https://ru.wikipedia.org'
];
const result = 'https://ru.wikipedia.org';
expect(render(input)).toBe(result);
});
});