tiny-blocks / ksuid

K-Sortable Unique Identifier.
https://packagist.org/packages/tiny-blocks/ksuid
MIT License
3 stars 1 forks source link

Enhance KSUID Testing Suite #15

Open vidhvath28 opened 1 day ago

vidhvath28 commented 1 day ago

Overview

This PR introduces a series of enhancements to the KSUID testing suite. It adds multiple new test cases to ensure the robustness and reliability of the KSUID implementation. The tests cover various edge cases and scenarios, helping to improve code quality and maintainability.

Changes Made

Added New Test Cases:

1.testFromInvalidPayload(): Validates behavior when an empty payload is provided.

  1. testFromFutureTimestamp(): Ensures that generating a KSUID from a future timestamp functions correctly.
  2. testGetValueConsistency(): Checks for consistent retrieval of the KSUID value.
  3. testGetPayloadHexConversion(): Confirms that the payload matches its hex conversion.
  4. testGetUnixTime(): Verifies that the Unix time corresponds with the provided timestamp.
  5. testInspectFromInvalidLength(): Tests how the system responds to KSUIDs of invalid lengths.
  6. testFromTimestampValidPayload(): Ensures that a KSUID created from a valid timestamp has a non-empty payload.