From dda36c2da0adbd7066a0aae1934ef896881d0c1b Mon Sep 17 00:00:00 2001 From: Jannis R Date: Thu, 28 Apr 2022 22:11:34 +0200 Subject: [PATCH] tests: enable linter, fix code style --- .eslintrc.json | 16 +++++++++++++--- test/bvg-radar.js | 1 - test/e2e/lib/util.js | 2 +- test/e2e/oebb.js | 10 +++++----- test/e2e/vbb.js | 12 ++++++------ 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index a53c0f0d..dbb60da4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,7 +9,7 @@ "Atomics": "readonly", "SharedArrayBuffer": "readonly" }, - "ignorePatterns": ["node_modules", "test", "*example.js"], + "ignorePatterns": ["node_modules", "*example.js"], "parserOptions": { "ecmaVersion": 2018 }, @@ -22,5 +22,15 @@ "ignoreRestSiblings": false } ] - } -} \ No newline at end of file + }, + "overrides": [ + { + "files": [ + "test/**" + ], + "rules": { + "no-unused-vars": "off" + } + } + ] +} diff --git a/test/bvg-radar.js b/test/bvg-radar.js index c9bfe3c9..371febc4 100644 --- a/test/bvg-radar.js +++ b/test/bvg-radar.js @@ -14,7 +14,6 @@ const opt = { results: 256, duration: 30, frames: 3, - products: null, polylines: true, when: '2019-08-19T21:00:00+02:00', products: {} diff --git a/test/e2e/lib/util.js b/test/e2e/lib/util.js index 25654c2d..f777dc64 100644 --- a/test/e2e/lib/util.js +++ b/test/e2e/lib/util.js @@ -32,7 +32,7 @@ const assertValidWhen = (actual, expected, name) => { throw new AssertionError({ message: name + ' is out of range', actual: ts, - expected: `${expected - delta} - ${+expected + delta}`, + expected: `${expected - delta} - ${+expected + delta}`, operator: 'isRoughlyEqual', }) } diff --git a/test/e2e/oebb.js b/test/e2e/oebb.js index 538950bb..46c2d950 100644 --- a/test/e2e/oebb.js +++ b/test/e2e/oebb.js @@ -63,7 +63,7 @@ const wienRenngasse = '1390186' const wienKarlsplatz = '1390461' const wienPilgramgasse = '1390562' -tap.test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => { +tap.test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => { const res = await client.journeys(salzburgHbf, wienFickeystr, { results: 4, departure: when, @@ -88,7 +88,7 @@ tap.test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => { // todo: journeys, only one product -tap.test('journeys – fails with no product', (t) => { +tap.test('journeys – fails with no product', (t) => { journeysFailsWithNoProduct({ test: t, fetchJourneys: client.journeys, @@ -103,9 +103,9 @@ tap.test('journeys – fails with no product', (t) => { tap.test('Salzburg Hbf to 1220 Wien, Fischerstrand 7', async (t) => { const wagramerStr = { type: 'location', - address: '1220 Wien, Fischerstrand 7', - latitude: 48.236216, - longitude: 16.425863 + address: '1220 Wien, Fischerstrand 7', + latitude: 48.236216, + longitude: 16.425863 } const res = await client.journeys(salzburgHbf, wagramerStr, { results: 3, diff --git a/test/e2e/vbb.js b/test/e2e/vbb.js index 1add74d1..05fc50e2 100644 --- a/test/e2e/vbb.js +++ b/test/e2e/vbb.js @@ -46,7 +46,7 @@ const westhafen = '900000001201' const wedding = '900000009104' const württembergallee = '900000026153' -tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => { +tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => { const res = await client.journeys({ type: 'stop', id: spichernstr, @@ -69,7 +69,7 @@ tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => { t.end() }) -tap.test('journeys – only subway', async (t) => { +tap.test('journeys – only subway', async (t) => { const res = await client.journeys(spichernstr, bismarckstr, { results: 20, departure: when, @@ -104,9 +104,9 @@ tap.test('journeys – only subway', async (t) => { t.end() }) -// todo: journeys – with arrival time +// todo: journeys – with arrival time -tap.test('journeys – fails with no product', (t) => { +tap.test('journeys – fails with no product', (t) => { journeysFailsWithNoProduct({ test: t, fetchJourneys: client.journeys, @@ -213,7 +213,7 @@ tap.skip('trips', async (t) => { t.end() }) -tap.test('journeys – station to address', async (t) => { +tap.test('journeys – station to address', async (t) => { const torfstr = { type: 'location', address: '13353 Berlin-Wedding, Torfstr. 17', @@ -235,7 +235,7 @@ tap.test('journeys – station to address', async (t) => { t.end() }) -tap.test('journeys – station to POI', async (t) => { +tap.test('journeys – station to POI', async (t) => { const atze = { type: 'location', id: '900980720',