-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
tests.js
59 lines (48 loc) · 1.44 KB
/
tests.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const tape = require('tape')
const _test = require('tape-promise').default
const test = _test(tape) // decorate tape
const util = require(`./util`)
test(`url extraction`, async (t) => {
const testData = [
{
input: `Someone's FLV->MP4 conversion directory: [http://212.224.80.123:8080/vod/](http://212.224.80.123:8080/vod/)`,
output: [
`http://212.224.80.123:8080/vod/`,
],
},
{
input: `last [link](https://modland.com/incoming/delivery%20bay/various/)`,
output: [
`https://modland.com/incoming/delivery%20bay/various/`,
],
},
{
input: `http://www.web.pdx.edu/~mcclured/The%20Boys/
http://www.arilou.org/songs/`,
output: [
`http://www.web.pdx.edu/~mcclured/The%20Boys/`,
`http://www.arilou.org/songs/`,
],
},
{
input: `http://cassidylou.com/wp-content/uploads/`,
output: [
`http://cassidylou.com/wp-content/uploads/`,
],
},
{
input: `http://178.32.222.201/
http://cdn1.moviehaat.net:8888/EnglishTVSerials/Bull/
[test](https://www.ifp.uni.wroc.pl/data/files/)`,
output: [
`http://178.32.222.201/`,
`http://cdn1.moviehaat.net:8888/EnglishTVSerials/Bull/`,
`https://www.ifp.uni.wroc.pl/data/files/`,
],
},
]
for (let data of testData) {
let actualOutput = util.urlsFromText(data.input)
t.deepEqual(actualOutput, data.output, `find all urls`)
}
})