(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestNewRestoreResultKeepsInputAndMetadata(t *testing.T) { |
| 102 | clientModified := time.Date(2026, 6, 16, 10, 0, 0, 0, time.UTC) |
| 103 | serverModified := time.Date(2026, 6, 17, 12, 30, 0, 0, time.UTC) |
| 104 | result, err := newRestoreResult("/Reports/old.pdf", "target-rev", &files.FileMetadata{ |
| 105 | Metadata: files.Metadata{ |
| 106 | PathDisplay: "/Reports/old.pdf", |
| 107 | PathLower: "/reports/old.pdf", |
| 108 | }, |
| 109 | Id: "id:abc", |
| 110 | Rev: "current-rev", |
| 111 | Size: 123, |
| 112 | ClientModified: dropbox.DBXTime(clientModified), |
| 113 | ServerModified: dropbox.DBXTime(serverModified), |
| 114 | }) |
| 115 | if err != nil { |
| 116 | t.Fatal(err) |
| 117 | } |
| 118 | |
| 119 | if result.Input.Path != "/Reports/old.pdf" || result.Input.Revision != "target-rev" { |
| 120 | t.Fatalf("input = %#v, want path and target revision", result.Input) |
| 121 | } |
| 122 | if result.Status != restoreStatusRestored || result.Kind != restoreKindFile { |
| 123 | t.Fatalf("status/kind = %s/%s, want restored/file", result.Status, result.Kind) |
| 124 | } |
| 125 | if result.Result.Type != "file" || result.Result.PathDisplay != "/Reports/old.pdf" { |
| 126 | t.Fatalf("metadata = %#v, want file path metadata", result.Result) |
| 127 | } |
| 128 | if result.Result.ID != "id:abc" || result.Result.Rev != "current-rev" || |
| 129 | result.Result.Size == nil || *result.Result.Size != 123 { |
| 130 | t.Fatalf("metadata = %#v, want id, current rev, and size", result.Result) |
| 131 | } |
| 132 | if result.Result.ServerModified == nil || *result.Result.ServerModified != "2026-06-17T12:30:00Z" { |
| 133 | t.Fatalf("server modified = %v, want 2026-06-17T12:30:00Z", result.Result.ServerModified) |
| 134 | } |
| 135 | if result.Result.ClientModified == nil || *result.Result.ClientModified != "2026-06-16T10:00:00Z" { |
| 136 | t.Fatalf("client modified = %v, want 2026-06-16T10:00:00Z", result.Result.ClientModified) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func TestRestoreJSONOutputsInputAndMetadata(t *testing.T) { |
| 141 | cmd, stdout := testRestoreCmd() |
nothing calls this directly
no test coverage detected