Skip to content

test(orm): add comprehensive QueryBuilder tests #482

Description

@GaspardKirira

Summary

Add automated tests for the complete QueryBuilder public surface.

The builder is lightweight but central to explicit custom ORM queries.

Current behavior

QueryBuilder supports:

  • initial SQL construction;
  • raw SQL fragments;
  • spaces and newlines;
  • typed parameters;
  • NULL parameters;
  • BLOB parameters;
  • parameter binding;
  • clearing;
  • reserving;
  • moving out SQL and parameters.

No automated tests protect these behaviors.

Expected behavior

Every public method must have deterministic unit-test coverage without requiring a database server.

Scope

  • Test default construction.
  • Test construction from initial SQL.
  • Test raw().
  • Test rawSpace().
  • Test space().
  • Test newline().
  • Test every param() overload.
  • Test paramNull().
  • Test parameter order.
  • Test bind() using a fake statement.
  • Test reserve().
  • Test clear().
  • Test empty().
  • Test takeSql().
  • Test takeParams().
  • Test the internal placeholder helper where appropriate.

Suggested files

  • modules/orm/tests/query_builder_test.cpp
  • modules/orm/tests/fakes/FakeStatement.hpp
  • modules/orm/src/QueryBuilder.cpp
  • modules/orm/include/vix/orm/QueryBuilder.hpp

Acceptance criteria

  • SQL fragments preserve insertion order.
  • Parameters preserve insertion order.
  • Every parameter overload produces the expected DbValue.
  • Binding starts at index one.
  • clear() removes SQL and parameters.
  • Move-out methods return the accumulated values.
  • Tests require no live database.
  • Existing public APIs remain unchanged.

Non-goals

This issue does not include:

  • a full query DSL;
  • SQL parsing;
  • placeholder validation;
  • repository filtering.

Suggested labels

  • scope:orm
  • type:ci
  • tests
  • good first issue
  • status:ready

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersscope:ormORM layerstatus:readyIssue is fully specified and ready for implementationtestsTests, CI coverage and validationtype:ciCI, tests, or tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions