소스 검색

implementing Mgrdich's suggestion

Mihai 1 년 전
부모
커밋
23d937a94c
1개의 변경된 파일6개의 추가작업 그리고 14개의 파일을 삭제
  1. 6 14
      kafka-ui-react-app/src/lib/hooks/__tests__/dateTimeHelpers.spec.ts

+ 6 - 14
kafka-ui-react-app/src/lib/hooks/__tests__/dateTimeHelpers.spec.ts

@@ -12,20 +12,12 @@ describe('dateTimeHelpers', () => {
 
     it('should output the correct date', () => {
       const date = new Date();
-      const formattedDate = formatTimestamp(date);
-      const formattedTimestamp = formatTimestamp(date.getTime());
-
-      const expected = `${
-        date.getMonth() + 1
-      }/${date.getDate()}/${date.getFullYear()}, ${date
-        .getHours()
-        .toString()
-        .padStart(2, '0')}:${date
-        .getMinutes()
-        .toString()
-        .padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`;
-      expect(formattedDate).toBe(expected);
-      expect(formattedTimestamp).toBe(expected);
+      expect(formatTimestamp(date)).toBe(
+        date.toLocaleString([], { hourCycle: 'h23' })
+      );
+      expect(formatTimestamp(date.getTime())).toBe(
+        date.toLocaleString([], { hourCycle: 'h23' })
+      );
     });
   });
 });