| 592 | } |
| 593 | |
| 594 | func TestLockMetadataToJSONWithStopTime(t *testing.T) { |
| 595 | // Test JSON serialization includes stop time when present |
| 596 | metadata := &LockMetadata{ |
| 597 | SchemaVersion: LockSchemaV1, |
| 598 | FrontmatterHash: "test123", |
| 599 | StopTime: "2026-02-17 20:00:00", |
| 600 | } |
| 601 | |
| 602 | json, err := metadata.ToJSON() |
| 603 | require.NoError(t, err) |
| 604 | assert.Contains(t, json, `"schema_version":"v1"`) |
| 605 | assert.Contains(t, json, `"frontmatter_hash":"test123"`) |
| 606 | assert.Contains(t, json, `"stop_time":"2026-02-17 20:00:00"`) |
| 607 | } |
| 608 | |
| 609 | func TestLockMetadataToJSONWithoutStopTime(t *testing.T) { |
| 610 | // Test JSON serialization omits stop time when empty (omitempty) |