From e949180f8a3c338325fdecd2900dc6c5e8a24652 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 9 Dec 2021 11:58:54 +0100 Subject: [PATCH] test: fix coverage --- .../github/__snapshots__/index.spec.ts.snap | 8 +++++++ lib/platform/github/index.spec.ts | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index 339ec34173c28d..d6715d11e3db39 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -7156,6 +7156,14 @@ Array [ ] `; +exports[`platform/github/index initPlatform() should support custom endpoint without version 1`] = ` +Object { + "endpoint": "https://ghe.renovatebot.com/", + "gitAuthor": "undefined ", + "renovateUsername": "renovate-bot", +} +`; + exports[`platform/github/index initPlatform() should support default endpoint no email access 1`] = ` Object { "endpoint": "https://api.github.com/", diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 97fd3541e27143..ebb9ef0581ee14 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -132,6 +132,30 @@ describe('platform/github/index', () => { ).toMatchSnapshot(); expect(httpMock.getTrace()).toMatchSnapshot(); }); + + it('should support custom endpoint without version', async () => { + httpMock + .scope('https://ghe.renovatebot.com') + .head('/') + .reply(200) + + .get('/user') + .reply(200, { + login: 'renovate-bot', + }) + .get('/user/emails') + .reply(200, [ + { + email: 'user@domain.com', + }, + ]); + expect( + await github.initPlatform({ + endpoint: 'https://ghe.renovatebot.com', + token: '123test', + }) + ).toMatchSnapshot(); + }); }); describe('getRepos', () => {