feat: add auth server package

This commit is contained in:
Karol Sójko
2022-06-22 12:33:00 +02:00
parent 143b215ddc
commit 8e5012009b
684 changed files with 33080 additions and 172 deletions
@@ -0,0 +1,30 @@
import 'reflect-metadata'
import { UserDisabledSessionUserAgentLoggingEvent } from '@standardnotes/domain-events'
import { SessionRepositoryInterface } from '../Session/SessionRepositoryInterface'
import { UserDisabledSessionUserAgentLoggingEventHandler } from './UserDisabledSessionUserAgentLoggingEventHandler'
describe('UserDisabledSessionUserAgentLoggingEventHandler', () => {
let sessionRepository: SessionRepositoryInterface
let event: UserDisabledSessionUserAgentLoggingEvent
const createHandler = () => new UserDisabledSessionUserAgentLoggingEventHandler(sessionRepository)
beforeEach(() => {
sessionRepository = {} as jest.Mocked<SessionRepositoryInterface>
sessionRepository.clearUserAgentByUserUuid = jest.fn()
event = {} as jest.Mocked<UserDisabledSessionUserAgentLoggingEvent>
event.payload = {
userUuid: '1-2-3',
email: '[email protected]',
}
})
it('should clear all user agent info from all user sessions', async () => {
await createHandler().handle(event)
expect(sessionRepository.clearUserAgentByUserUuid).toHaveBeenCalledWith('1-2-3')
})
})