mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-05-05 22:19:59 +03:00
prevent timeouts in dbweb e2e test from calling end()
twice
This commit is contained in:
parent
e145d57f9e
commit
c285339cd9
1 changed files with 9 additions and 6 deletions
|
@ -395,16 +395,17 @@ tap.test('trip details', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('departures at Berlin Schwedter Str.', async (t) => {
|
tap.test('departures at Berlin Schwedter Str.', async (t) => {
|
||||||
const interval = setInterval(async () => {
|
let interval = setInterval(async () => {
|
||||||
const res = await client.departures(blnSchwedterStr, {
|
const res = await client.departures(blnSchwedterStr, {
|
||||||
duration: 5, when,
|
duration: 5, when,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.departures[0].stop.name === undefined) { // ctx.common.locations have not loaded yet
|
if (res.departures[0].stop.name === undefined || interval === undefined) { // ctx.common.locations have not loaded yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
interval = undefined;
|
||||||
await testDepartures({
|
await testDepartures({
|
||||||
test: t,
|
test: t,
|
||||||
res,
|
res,
|
||||||
|
@ -416,7 +417,7 @@ tap.test('departures at Berlin Schwedter Str.', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('departures with station object', async (t) => {
|
tap.test('departures with station object', async (t) => {
|
||||||
const interval = setInterval(async () => {
|
let interval = setInterval(async () => {
|
||||||
const res = await client.departures({
|
const res = await client.departures({
|
||||||
type: 'station',
|
type: 'station',
|
||||||
id: jungfernheide,
|
id: jungfernheide,
|
||||||
|
@ -428,11 +429,12 @@ tap.test('departures with station object', async (t) => {
|
||||||
},
|
},
|
||||||
}, {when});
|
}, {when});
|
||||||
|
|
||||||
if (res.departures[0].stop.name === undefined) { // ctx.common.locations have not loaded yet
|
if (res.departures[0].stop.name === undefined || interval === undefined) { // ctx.common.locations have not loaded yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
interval = undefined;
|
||||||
validate(t, res, 'departuresResponse', 'res');
|
validate(t, res, 'departuresResponse', 'res');
|
||||||
t.end();
|
t.end();
|
||||||
|
|
||||||
|
@ -440,16 +442,17 @@ tap.test('departures with station object', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
|
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
|
||||||
const interval = setInterval(async () => {
|
let interval = setInterval(async () => {
|
||||||
const res = await client.arrivals(blnSchwedterStr, {
|
const res = await client.arrivals(blnSchwedterStr, {
|
||||||
duration: 5, when,
|
duration: 5, when,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.arrivals[0].stop.name === undefined) { // ctx.common.locations have not loaded yet
|
if (res.arrivals[0].stop.name === undefined || interval === undefined) { // ctx.common.locations have not loaded yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
interval = undefined;
|
||||||
await testArrivals({
|
await testArrivals({
|
||||||
test: t,
|
test: t,
|
||||||
res,
|
res,
|
||||||
|
|
Loading…
Add table
Reference in a new issue