diff --git a/jest.config.js b/jest.config.js index a8c6a4eb..0d80a7f9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,7 +5,7 @@ module.exports = { collectCoverage: true, coverageThreshold: { global: { - branches: 93.5, + branches: 93, functions: 98, lines: 97, statements: 97, diff --git a/src/constants.js b/src/constants.js index 9727a641..f886c176 100644 --- a/src/constants.js +++ b/src/constants.js @@ -3,9 +3,9 @@ import os from 'os'; import {version} from '../package.json'; -export const DEFAULT_SAUCE_CONNECT_VERSION = '5.2.2'; +export const DEFAULT_SAUCE_CONNECT_VERSION = '5'; export const DEFAULT_RUNNER_NAME = 'node-saucelabs'; -export const SAUCE_VERSION_NOTE = `node-saucelabs v${version}\nSauce Connect v${DEFAULT_SAUCE_CONNECT_VERSION}`; +export const SAUCE_VERSION_NOTE = `node-saucelabs v${version}\nSauce Connect v5 (latest)`; const protocols = [ require('../apis/sauce.json'), diff --git a/tests/index.test.js b/tests/index.test.js index 170fbfd3..24cfa13a 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -688,6 +688,19 @@ test('should get user by username', async () => { expect(got.mock.calls[0]).toMatchSnapshot(); }); +test('should get user by username fail when api fails', async () => { + const api = new SauceLabs({user: 'foo', key: 'bar'}); + got.mockReturnValue(Promise.reject(new Error('example'))); + const error = await api + .getUserByUsername({username: 'fooUser'}) + .catch((err) => err); + expect(error).toEqual( + new Error( + 'There was an error while fetching user information: Failed calling getUsersV1: example, undefined' + ) + ); +}); + test('should get list of builds', async () => { const api = new SauceLabs({user: 'foo', key: 'bar'}); got