forked from rbren/rss-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtml.js
45 lines (39 loc) · 1.09 KB
/
html.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use strict";
var fs = require('fs');
var HTTP = require('http');
var utils = require('../lib/utils.js');
var Expect = require('chai').expect;
var IN_DIR = __dirname + '/input';
var OUT_DIR = __dirname + '/output';
describe('Utils', function() {
it('should strip HTML appropriately', () => {
var testCases = [{
input: 'Hello world',
output: 'Hello world',
}, {
input: '<h4>hi</h4>my name is',
output: 'hi\nmy name is',
}, {
input: 'hello<br>world',
output: 'hello\nworld',
}, {
input: 'hello<hr>world',
output: 'hello\nworld',
}, {
input: 'hi<h3>my name is</h3>',
output: 'hi\nmy name is',
}, {
input: 'hello<p>world</p>my<p>name is</p>',
output: 'hello\nworld\nmy\nname is',
}, {
input: 'hello<span>my name is</span>',
output: 'hellomy name is',
}, {
input: 'hello<span> </span>my name is >',
output: 'hello my name is >',
}]
testCases.forEach(tc => {
Expect('|' + utils.getSnippet(tc.input) + '|').to.equal('|' + tc.output + '|', tc.input);
});
})
});