import { OAuthConfigResponse } from '../../builders/oauth-config-response'; describe('OAuthConfigResponse builder', () => { it('can build a response', () => { const oauthConfigResponse = new OAuthConfigResponse( 'https://bitbucket.com/install/app?appId=123&redirect=123', ); expect(oauthConfigResponse.build().authUrl).toMatchInlineSnapshot( `"https://bitbucket.com/install/app?appId=123&redirect=123"`, ); }); it('sets should upgrade to true and org name', () => { const orgName = 'org-name'; const oauthConfigResponse = new OAuthConfigResponse( 'https://bitbucket.com/install/app?appId=123&redirect=123', ).addUpgradeAppLink({ url: 'https://github.com/organizations/org-name/settings/installations/installation-id/permissions/update', orgName, shouldUpgrade: true, }); expect(oauthConfigResponse.build().upgrade[0]).toMatchInlineSnapshot(` Object { "orgName": "org-name", "shouldUpgradeApp": true, "url": "https://github.com/organizations/org-name/settings/installations/installation-id/permissions/update", } `); }); });