feat: enforce output version v1 and add version subcommand
This commit is contained in:
@@ -5,12 +5,13 @@ use gitea_pr_review::model::{
|
||||
#[test]
|
||||
fn model_json_roundtrip() {
|
||||
let doc = PrReviewDocument {
|
||||
version: "v1".into(),
|
||||
meta: PrMeta {
|
||||
repo: "org/repo".into(),
|
||||
pr_index: 9,
|
||||
title: "feat: x".into(),
|
||||
description: Some("desc".into()),
|
||||
fetched_at: Some("2026-04-08T12:34:56Z".into()),
|
||||
fetched_at: "2026-04-08T12:34:56Z".into(),
|
||||
state: "open".into(),
|
||||
author: "alice".into(),
|
||||
base_branch: "main".into(),
|
||||
@@ -50,7 +51,8 @@ fn model_json_roundtrip() {
|
||||
|
||||
let encoded = serde_json::to_string(&doc).unwrap();
|
||||
let decoded: PrReviewDocument = serde_json::from_str(&encoded).unwrap();
|
||||
assert_eq!(decoded.version, "v1");
|
||||
assert_eq!(decoded.meta.repo, "org/repo");
|
||||
assert_eq!(decoded.meta.fetched_at.as_deref(), Some("2026-04-08T12:34:56Z"));
|
||||
assert_eq!(decoded.meta.fetched_at, "2026-04-08T12:34:56Z");
|
||||
assert_eq!(decoded.threads[0].root_comment.body, "hello");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user