Skip to content

Commit

Permalink
fix: expose the last activity timestamp in session id check result (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 24, 2024
1 parent 4552c06 commit 2379c71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/__tests__/sessionid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ describe('Session ID manager', () => {
windowId: 'oldWindowID',
sessionId: 'oldSessionID',
sessionStartTimestamp: timestampOfSessionStart,
lastActivityTimestamp: expect.any(Number),
changeReason: undefined,
})
expect(persistence.register).toHaveBeenCalledWith({
[SESSION_ID]: [timestamp, 'oldSessionID', timestampOfSessionStart],
Expand All @@ -110,6 +112,7 @@ describe('Session ID manager', () => {
windowId: 'oldWindowID',
sessionId: 'oldSessionID',
sessionStartTimestamp: sessionStart,
lastActivityTimestamp: oldTimestamp,
})
expect(persistence.register).toHaveBeenCalledWith({
[SESSION_ID]: [oldTimestamp, 'oldSessionID', sessionStart],
Expand All @@ -122,6 +125,7 @@ describe('Session ID manager', () => {
windowId: 'newUUID',
sessionId: 'oldSessionID',
sessionStartTimestamp: timestampOfSessionStart,
lastActivityTimestamp: expect.any(Number),
changeReason: {
activityTimeout: false,
noSessionId: false,
Expand All @@ -142,6 +146,7 @@ describe('Session ID manager', () => {
windowId: 'newUUID',
sessionId: 'newUUID',
sessionStartTimestamp: timestamp,
lastActivityTimestamp: oldTimestamp,
changeReason: {
activityTimeout: true,
noSessionId: false,
Expand All @@ -164,6 +169,7 @@ describe('Session ID manager', () => {
windowId: 'newUUID',
sessionId: 'newUUID',
sessionStartTimestamp: timestamp,
lastActivityTimestamp: oldTimestamp,
changeReason: {
activityTimeout: true,
noSessionId: false,
Expand All @@ -188,6 +194,7 @@ describe('Session ID manager', () => {
windowId: 'newUUID',
sessionId: 'newUUID',
sessionStartTimestamp: timestamp,
lastActivityTimestamp: oldTimestamp,
changeReason: {
activityTimeout: false,
noSessionId: false,
Expand All @@ -210,6 +217,7 @@ describe('Session ID manager', () => {
windowId: 'newUUID',
sessionId: 'newUUID',
sessionStartTimestamp: now,
lastActivityTimestamp: oldTimestamp,
changeReason: {
activityTimeout: true,
noSessionId: false,
Expand All @@ -227,6 +235,7 @@ describe('Session ID manager', () => {
windowId: 'oldWindowID',
sessionId: 'oldSessionID',
sessionStartTimestamp: timestamp,
lastActivityTimestamp: timestamp,
})
expect(persistence.register).toHaveBeenCalledWith({
[SESSION_ID]: [timestamp, 'oldSessionID', timestamp],
Expand Down
1 change: 1 addition & 0 deletions src/sessionid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export class SessionIdManager {
windowId,
sessionStartTimestamp,
changeReason: valuesChanged ? { noSessionId, activityTimeout, sessionPastMaximumLength } : undefined,
lastActivityTimestamp: lastTimestamp,
}
}
}

0 comments on commit 2379c71

Please sign in to comment.