Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/LeanplumInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default class LeanplumInternal {
userAttributes = {}
}

if (this.hasActiveSession()) {
if (this.hasActiveSession() && !this._internalState.devMode) {
return this.startFromCache(userId, userAttributes, callback)
}

Expand Down
17 changes: 17 additions & 0 deletions test/specs/LeanplumInternal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,23 @@ describe(LeanplumInternal, () => {

expect(lpRequestMock.request).toHaveBeenCalledTimes(3)
})

it('always start new session in dev mode', () => {
lp.setAppIdForDevelopmentMode(APP_ID, KEY_DEV)

let currentTime = 0
jest.spyOn(Date, 'now').mockImplementation(() => currentTime)
lp.useSessionLength(2)

mockNextResponse({ response: [{ success: true }] })
lp.start()

currentTime = 500
mockNextResponse({ response: [{ success: true }] })
lp.start()

expect(lpRequestMock.request).toHaveBeenCalledTimes(2)
})
})
})

Expand Down