Skip to content

Commit 2429f68

Browse files
authored
Merge pull request #472 from chrismayer/geocode-test-handle-remote-fails
Make Geocoding test with remote service optional
2 parents 9df28ff + 7e0ef1e commit 2429f68

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/unit/specs/components/geocoder/Geocoder.spec.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,19 @@ describe('geocoder/Geocoder.vue', () => {
289289
expect(vm.onQueryResults).to.be.a('function');
290290
});
291291

292-
it('GeoCoderController calls remote service', done => {
293-
vm.geocoderController.query(queryString).then(results => {
294-
expect(results).to.not.be.undefined;
295-
expect(results).to.not.be.empty;
296-
expect(results[0].address.road).to.equal('Heerstraße');
297-
done();
298-
});
299-
});
292+
it('GeoCoderController calls remote service', async function () {
293+
try {
294+
const result = await vm.geocoderController.query(queryString);
295+
expect(result).to.not.be.undefined;
296+
expect(result).to.not.be.empty;
297+
expect(result[0].address.road).to.equal('Heerstraße');
298+
} catch (error) {
299+
if (error.code === 'ERR_NETWORK' || error.code === 'ECONNREFUSED' || error.code === 'ECONNABORTED' || error.message.includes('Network')) {
300+
this.skip();
301+
}
302+
throw error; // real failures still fail the test
303+
}
304+
}).timeout(16000); // timeout is 15 secs, so we make test timeout to 16 secs here (to be sure)
300305

301306
it('search method assigns last query string', async () => {
302307
applyAxiosMock();

0 commit comments

Comments
 (0)