Files
onix/pkg/plugin/implementation/router/router_test.go
Mayuresh 72593d2ab6 fix(router): support camelCase context attributes (bppUri, bapUri) for beckn spec migration
Replace fixed JSON struct tags for bpp_uri and bap_uri with a map-based parse of
the context object. A new getContextString() helper checks the snake_case key first
and falls back to the camelCase key, so routing works transparently for both the
legacy beckn spec and the new camelCase convention.

Also adds a nil-context guard so a missing context field returns a clear error
instead of a panic.

Test coverage:
- Two new cases in TestRouteSuccess for bppUri and bapUri camelCase payloads
- TestGetContextString: 5 table-driven cases covering snake, camel, precedence,
  missing, and empty-snake-fallthrough scenarios
- TestRouteNilContext: confirms clear error on missing context field

Fixes #636

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 15:41:16 +05:30

26 KiB