Skip to content

Conversation

@yourtion
Copy link
Owner

…overage across IPv4, IPv6, and the main library.

This commit introduces new unit tests to cover previously unasserted conditional branches in the IP address lookup logic.

Key improvements:

  • IPv4:
    • I added tests for search() and searchLong() when a valid IPv4 is not found in the database ranges (expecting null, though the current DB has a catch-all).
    • I also added a test for successful instantiation with an absolute DB path.
  • IPv6:
    • I added tests for parseResult() to handle IPv4-style results when this.ipv4 instance is not available (expecting null).
    • I also added tests for specific edge cases in city string parsing logic within parseResult().
  • Main Library (index.ts):
    • I added tests for searchRaw() to explicitly verify null output for invalid IP strings with both parse=true and parse=false.

These changes increase the robustness of the test suite and ensure more code paths are verified.

…overage across IPv4, IPv6, and the main library.

This commit introduces new unit tests to cover previously unasserted conditional branches in the IP address lookup logic.

Key improvements:

- IPv4:
  - I added tests for `search()` and `searchLong()` when a valid IPv4
    is not found in the database ranges (expecting null, though the current DB
    has a catch-all).
  - I also added a test for successful instantiation with an absolute DB path.
- IPv6:
  - I added tests for `parseResult()` to handle IPv4-style results when
    `this.ipv4` instance is not available (expecting null).
  - I also added tests for specific edge cases in city string parsing logic
    within `parseResult()`.
- Main Library (index.ts):
  - I added tests for `searchRaw()` to explicitly verify null output
    for invalid IP strings with both `parse=true` and `parse=false`.

These changes increase the robustness of the test suite and ensure more code paths are verified.
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.

2 participants