From 80857c535f076ad17666ecf0675bbadfc6cbe873 Mon Sep 17 00:00:00 2001 From: chris48s Date: Mon, 31 Jul 2023 11:14:14 +0100 Subject: [PATCH] set a default for authType, fix broken tests --- services/github/github-api-provider.js | 2 +- services/github/github-api-provider.spec.js | 6 +++++- services/github/github-auth-service.spec.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/services/github/github-api-provider.js b/services/github/github-api-provider.js index 520daa6533e56..4adf5d5ab29d7 100644 --- a/services/github/github-api-provider.js +++ b/services/github/github-api-provider.js @@ -43,7 +43,7 @@ class GithubApiProvider { // reserve it for the user. constructor({ baseUrl, - authType, + authType = this.constructor.AUTH_TYPES.NO_AUTH, onTokenInvalidated = tokenString => {}, globalToken, reserveFraction = 0.25, diff --git a/services/github/github-api-provider.spec.js b/services/github/github-api-provider.spec.js index ae9b9fdaff06b..31f4dcb5187fa 100644 --- a/services/github/github-api-provider.spec.js +++ b/services/github/github-api-provider.spec.js @@ -8,7 +8,11 @@ describe('Github API provider', function () { let mockStandardToken, mockSearchToken, mockGraphqlToken, provider beforeEach(function () { - provider = new GithubApiProvider({ baseUrl, reserveFraction }) + provider = new GithubApiProvider({ + baseUrl, + authType: GithubApiProvider.AUTH_TYPES.TOKEN_POOL, + reserveFraction, + }) mockStandardToken = { update: sinon.spy(), invalidate: sinon.spy() } sinon.stub(provider.standardTokens, 'next').returns(mockStandardToken) diff --git a/services/github/github-auth-service.spec.js b/services/github/github-auth-service.spec.js index 378d5034f6cf6..d75df3f9db6d4 100644 --- a/services/github/github-auth-service.spec.js +++ b/services/github/github-auth-service.spec.js @@ -41,6 +41,7 @@ describe('GithubAuthV3Service', function () { ) const githubApiProvider = new GithubApiProvider({ baseUrl: 'https://github-api.example.com', + authType: GithubApiProvider.AUTH_TYPES.TOKEN_POOL, restApiVersion: '2022-11-28', }) const mockToken = { update: sinon.mock(), invalidate: sinon.mock() }