Skip to content

Node SDK: add unit tests for the delete segments command #4795

Open

Description

@justinmclean

Description

DELETE_SEGMENTS.serialize in the Node SDK has no unit test. It calls serializeSegmentsParams in foreign/node/src/wire/segment/segment.utils.ts, which writes the stream identifier, the topic identifier, a uint32 partition id and a uint32 segment count, and throws when the count is below 1 or above 1000.

Affected area / component

Node SDK

Proposed solution

Add foreign/node/src/wire/segment/delete-segments.command.test.ts, modelled on foreign/node/src/wire/user/create-user.command.test.ts (node:test and node:assert/strict).

  • Check the exact output bytes for numeric identifiers and for string identifiers. Build the expected buffer by hand with Buffer.concat, so the test does not call the code it checks. identifier.utils.ts shows how identifiers serialise.
  • Check that a count of 1 and a count of 1000 are accepted, and that 0 and 1001 throw.
  • The error message says Topic partition_count must be between 1 and 1000, copied from the partition code. Only check that it throws; fixing the wording is a separate change.

How to test: npm run test:unit and npm run lint pass in foreign/node.

Good first issue

  • I think this could be a good first issue for a new contributor

Activity

  1. added
    good first issue
    test
    javascript
    on Nov 8, 2026
  2. himanchalkaushale commented on Nov 9, 2026

    @himanchalkaushale
    Contributor

    @justinmclean I want to work on this issue. Assign me

  3. justinmclean commented on Nov 9, 2026

    @justinmclean
    MemberAuthor

    All yours, if you have any questions just ask.

  4. github-actions commented on Nov 9, 2026

    @github-actions

    Note for maintainers: @himanchalkaushale is also assigned to good first issue #4700. New contributors take one good first issue. See CONTRIBUTING.md.

  5. slbotbm commented on Nov 9, 2026

    @slbotbm
    Contributor

    @himanchalkaushale since you've already completed one good first issue, i've unassigned you.

  6. armnkumar321-spec commented on Nov 9, 2026

    @armnkumar321-spec

    Hi @justinmclean, I'd like to take this one if it's still available. It would be my first contribution to Iggy.

    My plan, following the description:

    • Add foreign/node/src/wire/segment/delete-segments.command.test.ts, modelled on create-user.command.test.ts (node:test + node:assert/strict).
    • Check the exact output bytes for both numeric and string stream/topic identifiers. I'll build the expected buffer by hand with Buffer.concat, following identifier.utils.ts, so the test doesn't call the code it checks.
    • Cover the count limits: 1 and 1000 are accepted, 0 and 1001 throw. I'll only check that it throws, not the message wording.
    • Run npm run test:unit and npm run lint in foreign/node before opening the PR.

    Could you assign it to me? Thanks!

  7. justinmclean commented on Nov 9, 2026

    @justinmclean
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

good first issuejavascripttest

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions