forked from nfelger/achill
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0665bac
commit e6b13c6
Showing
5 changed files
with
656 additions
and
5 deletions.
There are no files selected for viewing
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
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
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,34 @@ | ||
import { | ||
getDescriptionForEventType, | ||
getItemForEventType, | ||
} from "~/utils/calendarEventUtils"; | ||
|
||
test("getItemForEventType should return correct icons", () => { | ||
expect(getItemForEventType("Holiday")).toBe("wb_sunny"); | ||
expect(getItemForEventType("Training")).toBe("school"); | ||
expect(getItemForEventType("PaidVacation")).toBe("beach_access"); | ||
expect(getItemForEventType("UnpaidVacation")).toBe("beach_access"); | ||
expect(getItemForEventType("CompensatoryTimeOff")).toBe("beach_access"); | ||
expect(getItemForEventType("Sick")).toBe("sick"); | ||
expect(getItemForEventType("NonExistentEventType" as any)).toBe("close"); | ||
}); | ||
|
||
test("getDescriptionForEventType should return correct descriptions", () => { | ||
expect(getDescriptionForEventType("Holiday")).toBe( | ||
"Public holiday, working impossible", | ||
); | ||
expect(getDescriptionForEventType("Training")).toBe("Learning"); | ||
expect(getDescriptionForEventType("PaidVacation")).toBe( | ||
"You are on paid vacation", | ||
); | ||
expect(getDescriptionForEventType("UnpaidVacation")).toBe( | ||
"You are on unpaid vacation", | ||
); | ||
expect(getDescriptionForEventType("CompensatoryTimeOff")).toBe( | ||
"Looks like you had some over hours", | ||
); | ||
expect(getDescriptionForEventType("Sick")).toBe("Sick leave"); | ||
expect(getDescriptionForEventType("NonExistentEventType" as any)).toBe( | ||
"Unknown", | ||
); | ||
}); |
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,88 @@ | ||
import { | ||
convertFloatTimeToHHMM, | ||
convertTimeStringToFloat, | ||
} from "~/utils/timeConverter"; | ||
|
||
describe("convertFloatTimeToHHMM", () => { | ||
test("1 returns 1:00", () => { | ||
expect(convertFloatTimeToHHMM(1)).toBe("1:00"); | ||
}); | ||
|
||
test("5 returns 5:00", () => { | ||
expect(convertFloatTimeToHHMM(5)).toBe("5:00"); | ||
}); | ||
|
||
test("1.5 returns 1:30", () => { | ||
expect(convertFloatTimeToHHMM(1.5)).toBe("1:30"); | ||
}); | ||
|
||
test("0.2 returns 0:20", () => { | ||
expect(convertFloatTimeToHHMM(0.2)).toBe("0:12"); | ||
}); | ||
|
||
test("0.33333 returns 0:20", () => { | ||
expect(convertFloatTimeToHHMM(0.33333)).toBe("0:20"); | ||
}); | ||
|
||
test("2.05 returns 2:03", () => { | ||
expect(convertFloatTimeToHHMM(2.05)).toBe("2:03"); | ||
}); | ||
|
||
test("0.0166 returns 0:01", () => { | ||
expect(convertFloatTimeToHHMM(0.0166)).toBe("0:01"); | ||
}); | ||
}); | ||
|
||
describe("convertTimeStringToFloat", () => { | ||
test("1:00 returns 1", () => { | ||
expect(convertTimeStringToFloat("1:00")).toBe(1); | ||
}); | ||
|
||
test("5:00 returns 5", () => { | ||
expect(convertTimeStringToFloat("5:00")).toBe(5); | ||
}); | ||
|
||
test("1:30 returns 1.5", () => { | ||
expect(convertTimeStringToFloat("1:30")).toBe(1.5); | ||
}); | ||
|
||
test("0:20 returns 0.2", () => { | ||
expect(convertTimeStringToFloat("0:12")).toBe(0.2); | ||
}); | ||
|
||
test("0:20 returns 0.33333", () => { | ||
expect(convertTimeStringToFloat("0:20")).toBe(1 / 3); | ||
}); | ||
|
||
test("2:03 returns 2.05", () => { | ||
expect(convertTimeStringToFloat("2:03")).toBe(2.05); | ||
}); | ||
|
||
test("0:01 returns 0.0166", () => { | ||
expect(convertTimeStringToFloat("0:01")).toBe(1 / 60); | ||
}); | ||
|
||
test("1:3 returns 1.5", () => { | ||
expect(convertTimeStringToFloat("1:3")).toBe(1.5); | ||
}); | ||
|
||
test("0,5 returns 0.5", () => { | ||
expect(convertTimeStringToFloat("0,5")).toBe(0.5); | ||
}); | ||
|
||
test("1,34563 returns 1.34563", () => { | ||
expect(convertTimeStringToFloat("1,34563")).toBe(1.34563); | ||
}); | ||
|
||
test("21,34563 returns 21.34563", () => { | ||
expect(convertTimeStringToFloat("21,34563")).toBe(21.34563); | ||
}); | ||
|
||
test("1.34563 returns 1.34563", () => { | ||
expect(convertTimeStringToFloat("1.34563")).toBe(1.34563); | ||
}); | ||
|
||
test("21.34563 returns 21.34563", () => { | ||
expect(convertTimeStringToFloat("21.34563")).toBe(21.34563); | ||
}); | ||
}); |
Oops, something went wrong.