Skip to content

test: add unit tests for config helpers and schema conversion#5

Open
Alex647648 wants to merge 1 commit intodimensionalOS:masterfrom
Alex647648:test/add-unit-tests
Open

test: add unit tests for config helpers and schema conversion#5
Alex647648 wants to merge 1 commit intodimensionalOS:masterfrom
Alex647648:test/add-unit-tests

Conversation

@Alex647648
Copy link

Summary

  • Add vitest as dev dependency with pnpm test script
  • Export getHost, getPort, jsonSchemaToTypebox for testability
  • Create index.test.ts with 15 test cases covering:
    • getHost: default, invalid config, custom host
    • getPort: default, invalid config, custom port
    • jsonSchemaToTypebox: empty/undefined input, string/number/integer/boolean/array/object types, required vs optional marking, unknown type fallback

Motivation

The project had zero tests. These cover the pure utility functions that are most likely to regress during refactoring, especially the schema conversion logic which handles many type variants.

Test plan

  • pnpm test — 15/15 tests pass

Add vitest as dev dependency and create comprehensive unit tests
covering config resolution and JSON Schema to TypeBox conversion.
Export the pure utility functions to make them testable.

15 test cases covering: default/custom config values, all schema types
(string, number, integer, boolean, array, object), required vs optional
properties, and unknown type fallback behavior.
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.

1 participant