-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78c60a9
commit 13ef761
Showing
2 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
ui/pages/bridge/transaction-details/transaction-details.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
BridgeHistoryItem, | ||
StatusTypes, | ||
} from '../../../../shared/types/bridge-status'; | ||
import { getIsDelayed } from './transaction-details'; | ||
|
||
describe('transaction-details', () => { | ||
describe('getIsDelayed', () => { | ||
it('returns false when status is not PENDING', () => { | ||
const result = getIsDelayed(StatusTypes.COMPLETE, { | ||
startTime: Date.now(), | ||
estimatedProcessingTimeInSeconds: 60, | ||
} as BridgeHistoryItem); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it('returns false when bridgeHistoryItem is undefined', () => { | ||
const result = getIsDelayed(StatusTypes.PENDING, undefined); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it('returns false when startTime is undefined', () => { | ||
const result = getIsDelayed(StatusTypes.PENDING, { | ||
startTime: undefined, | ||
estimatedProcessingTimeInSeconds: 60, | ||
} as BridgeHistoryItem); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it('returns false when current time is less than estimated completion time', () => { | ||
const result = getIsDelayed(StatusTypes.PENDING, { | ||
startTime: Date.now() - 1000, | ||
estimatedProcessingTimeInSeconds: 60, | ||
} as BridgeHistoryItem); | ||
|
||
expect(result).toBe(false); | ||
}); | ||
|
||
it('returns true when current time exceeds estimated completion time', () => { | ||
const startTime = Date.now() - 61 * 1000; | ||
|
||
const result = getIsDelayed(StatusTypes.PENDING, { | ||
startTime, | ||
estimatedProcessingTimeInSeconds: 60, | ||
} as BridgeHistoryItem); | ||
|
||
expect(result).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters