-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
66 lines (53 loc) · 1.66 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict'
const test = require('tape')
const s = require('./index.js')
test('removes "Bhf", but not ", Bhf"', (t) => {
t.plan(2)
t.strictEqual(s('S+U Foobar Bhf'), 'S+U Foobar')
t.strictEqual(s('Foo, Bhf'), 'Foo, Bhf')
})
test('shortens ", Bahnhof"', (t) => {
t.plan(1)
t.strictEqual(s('Rehfelde, Bahnhof'), 'Rehfelde, Bhf')
})
test('shortens ", Hauptbahnhof"', (t) => {
t.plan(1)
t.strictEqual(s('Schwerin, Hauptbahnhof'), 'Schwerin, Hbf')
})
test('shortens "U-Bhf." & "S-Bhf."', (t) => {
t.plan(2)
t.strictEqual(s('U-Bhf. Mehringdamm'), 'U Mehringdamm')
t.strictEqual(s('S-Bhf. Bellevue'), 'S Bellevue')
})
test('shortens "U-Bf." & "S-Bf."', (t) => {
t.plan(2)
t.strictEqual(s('U-Bf. Mehringdamm'), 'U Mehringdamm')
t.strictEqual(s('S-Bf. Bellevue'), 'S Bellevue')
})
test('removes "(Berlin)"', (t) => {
t.plan(1)
t.strictEqual(s('S+U Foo Bar (Berlin)'), 'S+U Foo Bar')
})
test('removes "(Bln)"', (t) => {
t.plan(1)
t.strictEqual(s('U Oskar-Helene-Heim (Bln) [Foo]'), 'U Oskar-Helene-Heim [Foo]')
})
test('removes "Berlin, "', (t) => {
t.plan(1)
t.equal(s('Berlin, Oberbaumbrücke'), 'Oberbaumbrücke')
})
test('shortens "…strasse" to "…str."', (t) => {
t.plan(8)
t.strictEqual(s('Strasse Foo'), 'Str. Foo')
t.strictEqual(s('S Foostrasse'), 'S Foostr.')
t.strictEqual(s('S Foo Strasse'), 'S Foo Str.')
t.strictEqual(s('S Foo-Strasse'), 'S Foo-Str.')
t.strictEqual(s('Straße Foo'), 'Str. Foo')
t.strictEqual(s('S Foostraße'), 'S Foostr.')
t.strictEqual(s('S Foo Straße'), 'S Foo Str.')
t.strictEqual(s('S Foo-Straße'), 'S Foo-Str.')
})
test('keeps everything else', (t) => {
t.plan(1)
t.strictEqual(s('S+U Foo Bar'), 'S+U Foo Bar')
})