fix(auth): Remove sharp edges from headless auth (#3985)

This commit is contained in:
N. Taylor Mullen
2025-07-12 15:42:47 -07:00
committed by GitHub
parent 890982a811
commit 4442e893c3
8 changed files with 118 additions and 85 deletions

View File

@@ -212,9 +212,7 @@ describe('oauth2', () => {
};
(readline.createInterface as Mock).mockReturnValue(mockReadline);
const consoleErrorSpy = vi
.spyOn(console, 'error')
.mockImplementation(() => {});
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
const client = await getOauthClient(
AuthType.LOGIN_WITH_GOOGLE,
@@ -226,7 +224,7 @@ describe('oauth2', () => {
// Verify the auth flow
expect(mockGenerateCodeVerifierAsync).toHaveBeenCalled();
expect(mockGenerateAuthUrl).toHaveBeenCalled();
expect(consoleErrorSpy).toHaveBeenCalledWith(
expect(consoleLogSpy).toHaveBeenCalledWith(
expect.stringContaining(mockAuthUrl),
);
expect(mockReadline.question).toHaveBeenCalledWith(
@@ -240,7 +238,7 @@ describe('oauth2', () => {
});
expect(mockSetCredentials).toHaveBeenCalledWith(mockTokens);
consoleErrorSpy.mockRestore();
consoleLogSpy.mockRestore();
});
describe('in Cloud Shell', () => {