Skip to content

Commit 59098ed

Browse files
committed
fix DbStatus.spec.tsx
1 parent 9d8a087 commit 59098ed

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

redisinsight/ui/src/pages/home/components/db-status/DbStatus.spec.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,22 @@ jest.mock('uiSrc/telemetry', () => ({
1818

1919
const mockedProps = mock<Props>()
2020
const daysToMs = (days: number) => days * 60 * 60 * 24 * 1000
21+
let mockDate: Date
2122

2223
describe('DbStatus', () => {
24+
beforeEach(() => {
25+
jest.clearAllMocks()
26+
27+
// Set up fake timers
28+
jest.useFakeTimers()
29+
mockDate = new Date('2024-11-22T12:00:00Z')
30+
jest.setSystemTime(mockDate)
31+
})
32+
33+
afterEach(() => {
34+
jest.useRealTimers()
35+
})
36+
2337
it('should render', () => {
2438
expect(render(<DbStatus {...mockedProps} />)).toBeTruthy()
2539
})
@@ -108,7 +122,7 @@ describe('DbStatus', () => {
108122

109123
await waitForRiTooltipVisible(1_000)
110124

111-
expect(sendEventTelemetry).toBeCalledWith({
125+
expect(sendEventTelemetry).toHaveBeenCalledWith({
112126
event: TelemetryEvent.CLOUD_NOT_USED_DB_NOTIFICATION_VIEWED,
113127
eventData: {
114128
capability: expect.any(String),

redisinsight/ui/src/pages/home/components/db-status/DbStatus.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ const DbStatus = (props: Props) => {
8888
)
8989

9090
if (isFree && daysDiff >= LAST_CONNECTION_L) {
91-
return renderWarningTooltip(CHECK_CLOUD_DATABASE, 'checkIfDeleted')
91+
return renderWarningTooltip(
92+
CHECK_CLOUD_DATABASE,
93+
WarningTypes.CheckIfDeleted,
94+
)
9295
}
9396

9497
if (isFree && daysDiff >= LAST_CONNECTION_SM) {

0 commit comments

Comments
 (0)