Skip to content

Commit 181e4a0

Browse files
committed
fix(skipTouch): continues the flow with the callback when skipping touch
1 parent fe99df4 commit 181e4a0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/express-session-etcd3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export default class Etcd3Store extends Store {
119119
touch = (sid: string, session: Express.SessionData, callback: (err: any) => void): void => {
120120
if (this.config.skipTouch) {
121121
this.debug('SKIP TOUCH "%s"', sid)
122+
callback(null)
122123
return
123124
}
124125
this.debug('TOUCH "%s" %O', sid, session)

test/express-session-etcd3.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,13 @@ describe('Etcd3Store test suit', () => {
182182
expect(subject.set).toHaveBeenCalledWith(sessionData.sid, sessionData, callback)
183183
})
184184

185-
it('should not set it again if skipTouch is true at the adapter config', async () => {
185+
it('should return the callback without set it again if skipTouch is true at the adapter config', async () => {
186186
const { subject, client } = await createSubject({ skipTouch: true })
187187
jest.spyOn(subject, 'set').mockImplementation(jest.fn())
188188
const callback = jest.fn()
189189
subject.touch(sessionData.sid, sessionData, callback)
190190
expect(subject.set).not.toHaveBeenCalled()
191+
expect(callback).toBeCalledWith(null)
191192
})
192193
})
193194

0 commit comments

Comments
 (0)