feat(shared): add isSupportedPlatform() helper and unit tests (closes…#297
Closed
amritbej wants to merge 1 commit into
Closed
feat(shared): add isSupportedPlatform() helper and unit tests (closes…#297amritbej wants to merge 1 commit into
amritbej wants to merge 1 commit into
Conversation
…ev-Card#9) - Add isSupportedPlatform(id: string): boolean to platforms.ts Uses PLATFORMS[id] !== undefined for the check - Add packages/shared/src/__tests__/platforms.test.ts with 9 tests: * valid platform IDs (github, linkedin, twitter, discord, email) → true * unknown/invalid IDs (unknown-platform, '', Github, GITHUB) → false * strict boolean return type assertion - TypeScript passes (tsc --noEmit) - All 31 shared tests pass
Contributor
Author
|
Hey @Harxhit , can you check it . |
Collaborator
|
Could you please add lint and unit tests proof. |
Contributor
Author
@Harxhit , i have added the unit tests and typecheck proof |
Contributor
Author
CI Results — ⏭️ No changes detected — all checks skipped
🕐 Last updated: |
Contributor
Author
|
@Harxhit please check it or is there any problem? |
Contributor
|
The changes are are relavent to the issue, closing this PR. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new helper function
isSupportedPlatform(id: string): booleantopackages/shared/src/platforms.tsand adds unit tests for supported and unsupported platform IDs.Closes #9
Type of Change
What Changed
Added
isSupportedPlatform(id: string): booleantopackages/shared/src/platforms.tsUses
PLATFORMS[id] !== undefinedfor safe platform existence checksAdded test coverage in
packages/shared/src/__tests__/platforms.test.tsAdded tests for:
github,linkedin,twitter,discord,email)How to Test
pnpm --filter @devcard/shared testChecklist
pnpm -r run lintpasses).pnpm -r run typecheck).pnpm -r run test).console.logor debug statements left in the code.Additional Context
ScreenShots
for unit test proof
for typeCheck proof

for eslint
Existing repository lint configuration issue (
eslintmissing in shared package) is pre-existing and unrelated to this PR.