-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
34 lines (32 loc) · 939 Bytes
/
test.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
"use strict"
const expect = require("unexpected")
const R = require("ramda")
const tested = require("./main")
describe("proxylist", () => {
it("main", (done) => {
tested.main().then((incoming) => {
expect(incoming, "to be an array")
expect(incoming.length, "to be greater than", 5)
expect(addressFn(incoming), "to be", true)
done()
})
})
it("second", (done) => {
tested.second().then((incoming) => {
expect(incoming, "to be an array")
expect(incoming.length, "to be greater than", 10)
expect(addressFn(incoming), "to be", true)
done()
})
})
})
function addressFn(addressArr) {
let flag = true
addressArr.map((address) => {
let state = R.match(/(?:[0-9\.\:])/g, address)
if (state.length !== address.length) {
flag = false
}
})
return flag
}