Skip to content

test: add unit tests for 5 untested modules#55

Open
zeroasterisk wants to merge 1 commit into
actioncard:mainfrom
zeroasterisk:test/add-missing-unit-tests
Open

test: add unit tests for 5 untested modules#55
zeroasterisk wants to merge 1 commit into
actioncard:mainfrom
zeroasterisk:test/add-missing-unit-tests

Conversation

@zeroasterisk

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive unit tests for the 5 library modules that had no corresponding test file:

  • A2A.FileContentfrom_bytes/2, from_uri/2, struct construction, option handling
  • A2A.Task.Filter — filtering by context_id, status, status_timestamp_after; pagination with page_size/page_token; history_length truncation; include_artifacts toggle; combined filter scenarios; invalid page token error
  • A2A.Task.Statusnew/1 and new/2 constructors, all 9 valid states, @enforce_keys validation
  • A2A.ID — prefix formatting, 12-char alphanumeric suffix, uniqueness across 100 generations
  • A2A.TaskStore — behaviour callback declarations, list_all/2 optional callback, ETS implementation contract check

Motivation

Every lib/ module now has at least one test file. The Task.Filter tests are the most substantial — they cover sorting, each individual filter, pagination edge cases (invalid token, empty token, last page), and combined filters.

Verification

  • Tests follow the same patterns as existing tests (ExUnit.Case, async: true, alias conventions)
  • No changes to library code — test-only PR

Test plan

  • mix test test/a2a/file_content_test.exs passes
  • mix test test/a2a/task/filter_test.exs passes
  • mix test test/a2a/task/status_test.exs passes
  • mix test test/a2a/id_test.exs passes
  • mix test test/a2a/task_store_test.exs passes
  • Full mix test passes with no regressions

Add comprehensive tests for modules that had no test coverage:

- A2A.FileContent: from_bytes/2, from_uri/2, struct construction
- A2A.Task.Filter: filtering by context_id/status/timestamp, pagination
  with page_size/page_token, history truncation, artifact stripping,
  combined filter scenarios, error cases
- A2A.Task.Status: new/1 and new/2 constructors, all valid states,
  enforce_keys validation
- A2A.ID: prefix formatting, suffix length/charset, uniqueness
- A2A.TaskStore: behaviour callback declarations, optional_callbacks,
  ETS implementation contract

These were the 5 lib modules with no corresponding test file.
@github-actions

Copy link
Copy Markdown

TCK 1.0-dev Compatibility Results (experimental)

This run is informational — failures do not block CI.

             A2A TCK Compatibility Report              
═══════════════════════════════════════════════════════
SUT: http://localhost:9999
Timestamp: 2026-06-21T23:49:41.921758+00:00

OVERALL COMPATIBILITY: 71.6%

┌─────────────┬────────┬────────┬─────────┬───────┐
│ Level       │ Passed │ Failed │ Skipped │ Total │
├─────────────┼────────┼────────┼─────────┼───────┤
│ MUST        │     44 │     35 │      35 │   114 │
│ SHOULD      │      2 │      9 │       0 │    11 │
│ MAY         │      2 │      2 │       0 │     4 │
└─────────────┴────────┴────────┴─────────┴───────┘

BY TRANSPORT:
  agent_card:    8/10 ⚠
  grpc:          0/72 (72 skipped) ✓
  jsonrpc:       50/100 (30 skipped) ⚠
  http_json:     3/83 (80 skipped) ✓

FAILED REQUIREMENTS:
  ✗ CARD-CACHE-002 (agent_card): Agent Card response should include an ETag header
  ✗ CARD-CACHE-003 (agent_card): Agent Card response may include a Last-Modified header
  ✗ DM-ART-001 (): Response contains no artifacts
  ✗ DM-MSG-001 (): Expected a Message response, but got a Task or no payload
  ✗ JSONRPC-SSE-002 (): Error code mismatch: expected ContentTypeNotSupportedError (-32005), got ParseError (-32700)
  ✗ JSONRPC-ERR-003 (): error.data is absent — A2A errors MUST include ErrorInfo in data array
  ✗ CORE-MULTI-004 (jsonrpc): Expected error code -32001 (TaskNotFoundError), got -32603
  ✗ CORE-HIST-001 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-HIST-002 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-HIST-003 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-HIST-004 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-HIST-005 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-HIST-006 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-GET-001 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_COMPLETED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-CANCEL-001 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-CANCEL-002 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_COMPLETED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-SEND-002 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_COMPLETED' but got 'TASK_STATE_WORKING'")
  ✗ CORE-MULTI-005 (jsonrpc): ('/home/runner/work/a2a-elixir/a2a-elixir/.tck-v1/tests/compatibility/_task_helpers.py', 98, "Skipped: Expected task state 'TASK_STATE_INPUT_REQUIRED' but got 'TASK_STATE_WORKING'")

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.

1 participant