mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
* Added no subscription support (#73) * Added no subscription support * Added L0s * added no subcriptions login support * test changes Co-authored-by: Ganesh S <ganeshs@CBREV-KESTUR.redmond.corp.microsoft.com> Co-authored-by: aksm-ms <58936966+aksm-ms@users.noreply.github.com> * adding lib Co-authored-by: Ganeshrockz <ganes@microsoft.com> Co-authored-by: Ganesh S <ganeshs@CBREV-KESTUR.redmond.corp.microsoft.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { ServicePrincipalLogin } from '../../src/PowerShell/ServicePrincipalLogin';
|
|
|
|
jest.mock('../../src/PowerShell/Utilities/Utils');
|
|
jest.mock('../../src/PowerShell/Utilities/PowerShellToolRunner');
|
|
let spnlogin: ServicePrincipalLogin;
|
|
|
|
beforeAll(() => {
|
|
spnlogin = new ServicePrincipalLogin("servicePrincipalID", "servicePrinicipalkey", "tenantId", "subscriptionId", false);
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
describe('Testing initialize', () => {
|
|
let initializeSpy;
|
|
|
|
beforeEach(() => {
|
|
initializeSpy = jest.spyOn(spnlogin, 'initialize');
|
|
});
|
|
test('ServicePrincipalLogin initialize should pass', async () => {
|
|
await spnlogin.initialize();
|
|
expect(initializeSpy).toHaveBeenCalled();
|
|
});
|
|
});
|
|
|
|
describe('Testing login', () => {
|
|
let loginSpy;
|
|
|
|
beforeEach(() => {
|
|
loginSpy = jest.spyOn(spnlogin, 'login');
|
|
});
|
|
test('ServicePrincipal login should pass', async () => {
|
|
loginSpy.mockImplementationOnce(() => Promise.resolve());
|
|
await spnlogin.login();
|
|
expect(loginSpy).toHaveBeenCalled();
|
|
});
|
|
});
|