fix(pi): resolve packaged proxy token lazily
This commit is contained in:
@@ -17,7 +17,8 @@ vi.mock('../../electron/services/providers/provider-service', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('../../electron/coding-runtime/pi/provider-config', () => ({
|
||||
vi.mock('../../electron/coding-runtime/pi/provider-config', async (importOriginal) => ({
|
||||
...await importOriginal<typeof import('../../electron/coding-runtime/pi/provider-config')>(),
|
||||
resolvePiProviderCredentialFromSecretStore: mocks.resolveCredential,
|
||||
}));
|
||||
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
isCodingProviderAuthenticationError,
|
||||
refreshCodingProviderCredential,
|
||||
} from '../../electron/api/coding-provider-auth';
|
||||
import { PiProviderConfigError } from '../../electron/coding-runtime/pi/provider-config';
|
||||
|
||||
describe('coding Provider credential refresh boundary', () => {
|
||||
beforeEach(() => {
|
||||
@@ -60,4 +62,13 @@ describe('coding Provider credential refresh boundary', () => {
|
||||
expect(isCodingProviderAuthenticationError(failure)).toBe(true);
|
||||
expect(mocks.updateAccount).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('classifies only the typed missing Provider credential as authentication-required', () => {
|
||||
expect(isCodingProviderAuthenticationError(
|
||||
new PiProviderConfigError('PROVIDER_AUTH_REQUIRED', 'Provider credential is unavailable'),
|
||||
)).toBe(true);
|
||||
expect(isCodingProviderAuthenticationError(
|
||||
new PiProviderConfigError('PROVIDER_INVALID', 'Provider configuration is invalid'),
|
||||
)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user