Skip to content

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

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

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
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

  • This is a minimal, low-risk additive helper function.
  • Shared package tests pass successfully.
  • Existing repository lint configuration issue (eslint missing in shared package) is pre-existing and unrelated to this PR.

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

1 participant