Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new list operation to the GitIgnoreIO SDK, enabling users to retrieve available technologies from the gitignore.io API.
- Adds
listTechnologies()method to fetch available technologies - Renames
GitIgnoreResultinterface toGitIgnoreContentfor better clarity - Includes comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/gitignoreio-sdk/src/domain/index.ts | Renames interface and adds listTechnologies method to SDK contract |
| packages/gitignoreio-sdk/src/adapters/sdk.ts | Implements listTechnologies method with API call and response parsing |
| packages/gitignoreio-sdk/src/adapters/tests/sdk.test.ts | Adds test cases for the new listTechnologies functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return result as unknown as Technologies[]; | ||
| } | ||
| } |
There was a problem hiding this comment.
The double type assertion as unknown as suggests a type mismatch. Consider properly typing the result from the API response parsing or creating a proper type guard function to validate the data structure before returning.
| return result as unknown as Technologies[]; | |
| } | |
| } | |
| if (!isTechnologiesArray(result)) { | |
| throw new Error('API response does not match expected Technologies[] type'); | |
| } | |
| return result; | |
| } | |
| } | |
| /** | |
| * Type guard to check if a value is a Technologies[] (array of non-empty strings). | |
| */ | |
| function isTechnologiesArray(arr: unknown): arr is Technologies[] { | |
| return ( | |
| Array.isArray(arr) && | |
| arr.every((item) => typeof item === 'string' && item.trim().length > 0) | |
| ); | |
| } |
| ); | ||
| expect(result).toStrictEqual(['a', 'b', 'c']); | ||
| }); | ||
|
|
There was a problem hiding this comment.
There's trailing whitespace on this line. Remove the extra spaces for consistent formatting.
02003ef to
659cbd2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
===========================================
+ Coverage 35.10% 98.59% +63.48%
===========================================
Files 9 7 -2
Lines 94 71 -23
Branches 15 24 +9
===========================================
+ Hits 33 70 +37
+ Misses 61 1 -60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.