test: Add comprehensive test suite for MR ingestion
Introduces thorough test coverage for merge request functionality, following the established testing patterns from issue ingestion. New test files: - mr_transformer_tests.rs: NormalizedMergeRequest transformation tests covering full MR with all fields, minimal MR, draft detection via title prefix and work_in_progress field, label/assignee/reviewer extraction, and timestamp conversion - mr_discussion_tests.rs: MR discussion normalization tests including polymorphic noteable binding, DiffNote position extraction with line ranges and SHA triplet, and resolvable note handling - diffnote_position_tests.rs: Exhaustive DiffNote position scenarios covering text/image/file types, single-line vs multi-line comments, added/removed/modified lines, and missing position handling New fixtures: - fixtures/gitlab_merge_request.json: Representative MR API response with nested structures for integration testing Updated tests: - gitlab_types_tests.rs: Add MR type deserialization tests - migration_tests.rs: Update expected schema version to 6 Test design follows property-based patterns where feasible, with explicit edge case coverage for nullable fields and API variants across different GitLab versions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
27
tests/fixtures/gitlab_merge_request.json
vendored
Normal file
27
tests/fixtures/gitlab_merge_request.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"id": 12345,
|
||||
"iid": 42,
|
||||
"project_id": 100,
|
||||
"title": "Add user authentication",
|
||||
"description": "Implements JWT auth flow",
|
||||
"state": "merged",
|
||||
"draft": false,
|
||||
"work_in_progress": false,
|
||||
"source_branch": "feature/auth",
|
||||
"target_branch": "main",
|
||||
"sha": "abc123def456",
|
||||
"references": { "short": "!42", "full": "group/project!42" },
|
||||
"detailed_merge_status": "mergeable",
|
||||
"merge_status": "can_be_merged",
|
||||
"created_at": "2024-01-15T10:00:00Z",
|
||||
"updated_at": "2024-01-20T14:30:00Z",
|
||||
"merged_at": "2024-01-20T14:30:00Z",
|
||||
"closed_at": null,
|
||||
"author": { "id": 1, "username": "johndoe", "name": "John Doe" },
|
||||
"merge_user": { "id": 2, "username": "janedoe", "name": "Jane Doe" },
|
||||
"merged_by": { "id": 2, "username": "janedoe", "name": "Jane Doe" },
|
||||
"labels": ["enhancement", "auth"],
|
||||
"assignees": [{ "id": 3, "username": "bob", "name": "Bob Smith" }],
|
||||
"reviewers": [{ "id": 4, "username": "alice", "name": "Alice Wong" }],
|
||||
"web_url": "https://gitlab.example.com/group/project/-/merge_requests/42"
|
||||
}
|
||||
Reference in New Issue
Block a user