-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: types for car schema and cleanup caching
• Add number field to car schema • Move CACHE_TTL to config • Remove strict() from schema definitions • Clean up tsconfig formatting • Fix schema imports and fields
- Loading branch information
1 parent
abf111c
commit 8444268
Showing
5 changed files
with
64 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { groupMonthsByYear } from "../groupMonthsByYear"; | ||
|
||
describe("groupMonthsByYear", () => { | ||
it("should group months by year", () => { | ||
const months = ["2022-01", "2022-12", "2023-01", "2023-02"]; | ||
|
||
expect(Object.keys(groupMonthsByYear(months))).toHaveLength(2); | ||
expect(groupMonthsByYear(months)).toEqual([ | ||
{ year: "2023", months: ["02", "01"] }, | ||
{ year: "2022", months: ["12", "01"] }, | ||
]); | ||
}); | ||
|
||
it("should handle empty array", () => { | ||
const months: string[] = []; | ||
|
||
const result = groupMonthsByYear(months); | ||
|
||
expect(Object.keys(result)).toHaveLength(0); | ||
}); | ||
|
||
it("should handle single year", () => { | ||
const months = ["2023-01", "2023-02", "2023-03"]; | ||
|
||
expect(Object.keys(groupMonthsByYear(months))).toHaveLength(1); | ||
expect(groupMonthsByYear(months)).toEqual([ | ||
{ | ||
year: "2023", | ||
months: ["03", "02", "01"], | ||
}, | ||
]); | ||
}); | ||
}); |
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
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