Skip to content

Commit f71785c

Browse files
committed
fix(azure-identity,msal-node): fix double-registration in mock README example
The Testing section called enableAuthMock(configurator) once for its return value, then again with a configure callback to seed the account. The second call replaces the first provider (enableAuthMock always registers last), so the retained `auth` reference from the first call was no longer the active provider by the time login/acquireAccessToken ran against it. Collapse to a single enableAuthMock call that both seeds the account and returns the provider that stays registered. Addresses review feedback on PR #5244 (copilot-pull-request-reviewer).
1 parent 6f31c73 commit f71785c

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

packages/modules/azure-identity/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ that need to exercise sign-in, sign-out, or token-refresh/expiry logic, use
123123
```typescript
124124
import { enableAuthMock } from '@equinor/fusion-framework-module-azure-identity/mock';
125125

126-
// default identity, already signed in
127-
const auth = enableAuthMock(configurator);
128-
129-
// or seed the identity/state up front
130-
enableAuthMock(configurator, (auth) => {
126+
// seed the identity/state up front; omit the callback for a default, already-signed-in identity
127+
const auth = enableAuthMock(configurator, (auth) => {
131128
auth.setAccount({ username: 'ada@equinor.com', signedOut: true });
132129
});
133130

packages/modules/msal-node/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,8 @@ that need to exercise sign-in, sign-out, or token-refresh/expiry logic, use
106106
```typescript
107107
import { enableAuthMock } from '@equinor/fusion-framework-module-msal-node/mock';
108108

109-
// default identity, already signed in
110-
const auth = enableAuthMock(configurator);
111-
112-
// or seed the identity/state up front
113-
enableAuthMock(configurator, (auth) => {
109+
// seed the identity/state up front; omit the callback for a default, already-signed-in identity
110+
const auth = enableAuthMock(configurator, (auth) => {
114111
auth.setAccount({ username: 'ada@equinor.com', signedOut: true });
115112
});
116113

0 commit comments

Comments
 (0)