import { handleAlksDeveloperInfo } from './alks-developer-info'; import { getDeveloper } from '../state/developer'; import { getToken } from '../state/token'; import { checkForUpdate } from '../checkForUpdate'; jest.mock('../state/developer'); jest.mock('../state/token'); jest.mock('../checkForUpdate'); jest.mock('../errorAndExit'); describe('handleAlksDeveloperInfo', () => { let output: string; beforeEach(async () => { output = ''; jest.spyOn(global.console, 'log').mockImplementation((s?: unknown) => { output += String(s); }); jest.spyOn(global.console, 'error').mockImplementation(() => {}); (getDeveloper as jest.Mock).mockResolvedValue({ server: 'https://alks.example.com/rest', userid: 'bobby', alksAccount: '012345678910/ALKSAdmin', alksRole: 'Admin', outputFormat: 'env', }); (getToken as jest.Mock).mockResolvedValue('tok-abcdefgh'); (checkForUpdate as jest.Mock).mockResolvedValue(undefined); await handleAlksDeveloperInfo({}); }); afterEach(() => { jest.restoreAllMocks(); }); it('does not render a Password row', () => { expect(output).not.toContain('Password'); }); it('does not render a Network Login (userid) row', () => { expect(output).not.toContain('Network Login'); }); it('renders the 2FA Token row', () => { expect(output).toContain('2FA Token'); }); it('renders the ALKS Server row (happy path executed)', () => { expect(output).toContain('ALKS Server'); }); });