-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
45 lines (39 loc) · 950 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
35
36
37
38
39
40
41
42
43
44
45
'use strict'
const fs = require('fs')
const path = require('path')
const {parse} = require('ndjson')
const test = require('tape')
const readNdjson = (t, file) => {
return fs.createReadStream(path.join(__dirname, file))
.on('error', t.ifError)
.pipe(parse())
.on('error', t.ifError)
}
test('nodes.ndjson contains S+U Friedrichstr.', (t) => {
t.plan(1)
readNdjson(t, 'nodes.ndjson')
.on('data', (node) => {
if (node.id === '900000100001') {
t.equal(node.label, 'S+U Friedrichstr.')
}
})
.on('end', () => {
t.end()
})
})
test('edges.ndjson contains S5 from Friedrichstr. to Hauptbahnhof', (t) => {
t.plan(1)
readNdjson(t, 'edges.ndjson')
.on('data', (node) => {
if (
node.source === '900000100001'
&& node.target === '900000003201'
&& node.relation === 'suburban'
&& node.metadata
&& node.metadata.line === 'S5'
) t.pass('contains S5 Friedrichstr -> Hauptbahnhof')
})
.on('end', () => {
t.end()
})
})