Skip to content

feat(shared): add isSupportedPlatform() helper and unit tests (closes…#297

Closed
amritbej wants to merge 1 commit into
Dev-Card:mainfrom
amritbej:feature/is-supported-platform-9
Closed

feat(shared): add isSupportedPlatform() helper and unit tests (closes…#297
amritbej wants to merge 1 commit into
Dev-Card:mainfrom
amritbej:feature/is-supported-platform-9

Conversation

@amritbej

@amritbej amritbej commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new helper function isSupportedPlatform(id: string): boolean to packages/shared/src/platforms.ts and adds unit tests for supported and unsupported platform IDs.

Closes #9


Type of Change

  • New feature
  • Tests only

What Changed

  • Added isSupportedPlatform(id: string): boolean to packages/shared/src/platforms.ts

  • Uses PLATFORMS[id] !== undefined for safe platform existence checks

  • Added test coverage in packages/shared/src/__tests__/platforms.test.ts

  • Added tests for:

    • valid platform IDs (github, linkedin, twitter, discord, email)
    • invalid/unknown platform IDs
    • strict boolean return behavior

How to Test

  1. Install dependencies
pnpm install
  1. Run shared package tests
pnpm --filter @devcard/shared test
  1. Verify all tests pass successfully

Checklist

  • My code follows the project's coding style (pnpm -r run lint passes).
  • TypeScript compiles without errors (pnpm -r run typecheck).
  • I have added or updated tests for the changes I made.
  • All tests pass locally (pnpm -r run test).
  • I have updated documentation where necessary.
  • No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

Additional Context

ScreenShots

for unit test proof

Test-passed

for typeCheck proof
Typescript-check

for eslint

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

  • This is a minimal, low-risk additive helper function.
  • Shared package tests pass successfully.

…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
@amritbej

Copy link
Copy Markdown
Contributor Author

Hey @Harxhit , can you check it .

@Harxhit

Harxhit commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Could you please add lint and unit tests proof.

@amritbej

Copy link
Copy Markdown
Contributor Author

Could you please add lint and unit tests proof.

@Harxhit , i have added the unit tests and typecheck proof

@amritbej

amritbej commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Could you please add lint and unit tests proof.

@Harxhit , i have added the unit tests and typecheck proof

@Harxhit please merge it i have added the proofs

@Harxhit Harxhit closed this Jun 1, 2026
@Harxhit Harxhit reopened this Jun 1, 2026
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

CI Results — ⏭️ No changes detected — all checks skipped

Check Status
🖥️ Backend ⏭️ Skipped — no changes detected
📱 Mobile ⏭️ Skipped — no changes detected
🌐 Web ⏭️ Skipped — no changes detected

⏭️ Skipped means no files were changed in that area — the check was not needed.


🕐 Last updated: Mon, 01 Jun 2026 18:40:33 GMT

@amritbej

amritbej commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@Harxhit please check it or is there any problem?

@ShantKhatri

Copy link
Copy Markdown
Contributor

The changes are are relavent to the issue, closing this PR.

@ShantKhatri ShantKhatri closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shared: add missing getPlatform() type-check helper and unit tests

3 participants