Skip to content

Commit bacfbf6

Browse files
no identity available on set identity
1 parent 8460640 commit bacfbf6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/integrationTests/options.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,5 +608,16 @@ describe('Store config UID2', () => {
608608
identity: expiredIdentity2,
609609
});
610610
});
611+
test('runs NoIdentityAvailable event', () => {
612+
uid2.init({});
613+
let expiredIdentity = makeIdentity({
614+
identity_expires: Date.now() - 5000,
615+
refresh_expires: Date.now() - 5000,
616+
});
617+
uid2.setIdentity(expiredIdentity);
618+
expect(handler).toHaveBeenLastCalledWith(EventType.NoIdentityAvailable, {
619+
identity: null,
620+
});
621+
});
611622
});
612623
});

src/sdkBase.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ export abstract class SdkBase {
158158
this.triggerRefreshOrSetTimer(validatedIdentity);
159159
}
160160
this._callbackManager.runCallbacks(EventType.IdentityUpdated, {});
161+
} else {
162+
this._callbackManager.runCallbacks(EventType.NoIdentityAvailable, {});
161163
}
162164
}
163165

0 commit comments

Comments
 (0)