From 0de3ac0a679a2e5ab78451231d4e3551e01d7434 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 10 Apr 2022 19:52:49 +0000 Subject: [PATCH] =?UTF-8?q?Add=20tests=20=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 2 +- src/drivers/bitbucket_cloud.js | 2 +- src/drivers/bitbucket_cloud.test.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e625c42dd..50e21abcf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,7 +11,7 @@ module.exports = { SharedArrayBuffer: 'readonly' }, parserOptions: { - ecmaVersion: 2018 + ecmaVersion: 2020 }, ignorePatterns: ['assets/', 'dist/', 'node_modules/'], rules: { diff --git a/src/drivers/bitbucket_cloud.js b/src/drivers/bitbucket_cloud.js index 27abb9c89..2316fe1c1 100644 --- a/src/drivers/bitbucket_cloud.js +++ b/src/drivers/bitbucket_cloud.js @@ -380,7 +380,7 @@ class BitbucketCloud { // from BitBucket API responses: `{"error": {"message": "Error message"}}` and // `{"error": "Error message"}`, apart from plain text responses like `Bad Request`. const error = - responseBody.error.message || responseBody.error || responseBody; + responseBody?.error?.message || responseBody?.error || responseBody; throw new Error(`${response.statusText} ${error}`.trim()); } diff --git a/src/drivers/bitbucket_cloud.test.js b/src/drivers/bitbucket_cloud.test.js index 594159615..435314636 100644 --- a/src/drivers/bitbucket_cloud.test.js +++ b/src/drivers/bitbucket_cloud.test.js @@ -29,9 +29,9 @@ describe('Non Enviromental tests', () => { test('Publish', async () => { const path = `${__dirname}/../../assets/logo.png`; - await expect(client.upload({ path })).rejects.toThrow( - 'Bitbucket Cloud does not support upload!' - ); + const { uri } = await client.upload({ path }); + + expect(uri).not.toBeUndefined(); }); test('Runner token', async () => {