mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
22 lines
941 B
TypeScript
22 lines
941 B
TypeScript
import { CommunityHandshakeState } from 'database'
|
|
import { CommunityHandshakeStateLogic } from './CommunityHandshakeState.logic'
|
|
import { CommunityHandshakeStateType } from 'database'
|
|
import { FEDERATION_AUTHENTICATION_TIMEOUT_MS } from 'shared'
|
|
|
|
describe('CommunityHandshakeStateLogic', () => {
|
|
it('isTimeout', () => {
|
|
const state = new CommunityHandshakeState()
|
|
state.updatedAt = new Date(Date.now() - FEDERATION_AUTHENTICATION_TIMEOUT_MS * 2)
|
|
state.status = CommunityHandshakeStateType.START_AUTHENTICATION
|
|
const logic = new CommunityHandshakeStateLogic(state)
|
|
expect(logic.isTimeout()).toEqual(true)
|
|
})
|
|
|
|
it('isTimeout return false', () => {
|
|
const state = new CommunityHandshakeState()
|
|
state.updatedAt = new Date(Date.now())
|
|
state.status = CommunityHandshakeStateType.START_AUTHENTICATION
|
|
const logic = new CommunityHandshakeStateLogic(state)
|
|
expect(logic.isTimeout()).toEqual(false)
|
|
})
|
|
}) |