From 0c22e013971fa4073d658c6c072ee58f391d887d Mon Sep 17 00:00:00 2001 From: developomp Date: Mon, 31 Jul 2023 00:57:55 +0900 Subject: [PATCH] test: check output value range --- apps/main/src/utils/getAge.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/main/src/utils/getAge.test.ts b/apps/main/src/utils/getAge.test.ts index 39537a2..500c53f 100644 --- a/apps/main/src/utils/getAge.test.ts +++ b/apps/main/src/utils/getAge.test.ts @@ -89,6 +89,8 @@ describe("getAge tests", () => { ["2023-07-31 00:00:00.000+09:00", 0.00273224043715847], ])("ageDecimal to work for '%s'", (date, expected) => { expect(ageDecimal(dayjs(date))).toEqual(expected) + expect(ageDecimal(dayjs(date))).toBeGreaterThanOrEqual(0.0) + expect(ageDecimal(dayjs(date))).toBeLessThan(1.0) }) test.each<[string, number]>([