fix: Retry message not working if the conversation has an external issue (#8529)

This commit is contained in:
Sivin Varghese
2023-12-13 15:46:10 +05:30
committed by GitHub
parent 60a312ace5
commit 3adaa2d602
6 changed files with 96 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import {
formatDigitToString,
isTimeAfter,
generateRelativeTime,
getDayDifferenceFromNow,
} from '../DateHelper';
describe('#DateHelper', () => {
@@ -120,3 +121,25 @@ describe('generateRelativeTime', () => {
expect(actualResult).toBe(expectedResult);
});
});
describe('#getDayDifferenceFromNow', () => {
it('should return the difference if in same day', () => {
const now = new Date('2023-12-08T00:00:00.000Z');
const timestampInSeconds = 1702020305; // 08/12/2023, 12:55:05 (GMT+05:30)
const expectedResult = 0;
const actualResult = getDayDifferenceFromNow(now, timestampInSeconds);
expect(actualResult).toBe(expectedResult);
});
it('should return the difference if in different day', () => {
const now = new Date('2023-12-11T00:00:00.000Z');
const timestampInSeconds = 1702020305; // 08/12/2023, 12:55:05 (GMT+05:30)
const expectedResult = 2;
const actualResult = getDayDifferenceFromNow(now, timestampInSeconds);
expect(actualResult).toBe(expectedResult);
});
});