(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestRevsUsesListRevisionsAndCommandOutput(t *testing.T) { |
| 75 | cmd, stdout := testRevsCmd() |
| 76 | var gotPath string |
| 77 | var gotLimit uint64 |
| 78 | |
| 79 | stubFilesClient(t, &mockFilesClient{ |
| 80 | listRevisionsFn: func(arg *files.ListRevisionsArg) (*files.ListRevisionsResult, error) { |
| 81 | gotPath = arg.Path |
| 82 | gotLimit = arg.Limit |
| 83 | return files.NewListRevisionsResult(false, []*files.FileMetadata{ |
| 84 | {Rev: "rev-c"}, |
| 85 | }, false), nil |
| 86 | }, |
| 87 | }) |
| 88 | |
| 89 | if err := revs(cmd, []string{"/report.pdf"}); err != nil { |
| 90 | t.Fatalf("revs returned error: %v", err) |
| 91 | } |
| 92 | |
| 93 | if gotPath != "/report.pdf" { |
| 94 | t.Fatalf("ListRevisions path = %q, want %q", gotPath, "/report.pdf") |
| 95 | } |
| 96 | if gotLimit != 10 { |
| 97 | t.Fatalf("ListRevisions limit = %d, want SDK default 10", gotLimit) |
| 98 | } |
| 99 | if got, want := stdout.String(), "rev-c\n"; got != want { |
| 100 | t.Fatalf("stdout = %q, want %q", got, want) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func TestRevsJSONOutputsInputAndResults(t *testing.T) { |
| 105 | cmd, stdout := testRevsCmd() |
nothing calls this directly
no test coverage detected