From cf4be7682563a64dc18395f3e5b570a0143580ca Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 21 Jan 2021 12:00:16 +0100 Subject: [PATCH] test(scaffolder-backend/azure): added a test for the new cojndif for azure: --- .../src/scaffolder/stages/publish/azure.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/azure.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/azure.test.ts index 0251b3d983..e4410e9838 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/azure.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/azure.test.ts @@ -17,7 +17,7 @@ jest.mock('./helpers'); jest.mock('azure-devops-node-api', () => ({ WebApi: jest.fn(), - getPersonalAccessTokenHandler: jest.fn(), + getPersonalAccessTokenHandler: jest.fn().mockReturnValue(() => {}), })); import { AzurePublisher } from './azure'; @@ -50,13 +50,18 @@ describe('Azure Publisher', () => { const result = await publisher!.publish({ values: { - storePath: 'project/repo', + storePath: 'https://dev.azure.com/organisation/project/_git/repo', owner: 'bob', }, directory: '/tmp/test', logger, }); + expect(WebApi).toHaveBeenCalledWith( + 'https://dev.azure.com/organisation', + expect.any(Function), + ); + expect(result).toEqual({ remoteUrl: 'https://dev.azure.com/organization/project/_git/repo', catalogInfoUrl: