mockProvider implements provider for testing.
| 30 | |
| 31 | // mockProvider implements provider for testing. |
| 32 | type mockProvider struct { |
| 33 | meta content.Meta |
| 34 | files []content.File |
| 35 | err error |
| 36 | repos []source.Source |
| 37 | // Optional per-commit overrides. When non-nil, GetMeta/GetFiles serve the |
| 38 | // entry for the requested commit (or a not-found error), letting tests |
| 39 | // distinguish HEAD from an older sha. When nil, the legacy m.meta/m.files |
| 40 | // behavior is used (ignoring the commit arg). |
| 41 | byCommit map[string]content.Meta |
| 42 | filesByCommit map[string][]content.File |
| 43 | } |
| 44 | |
| 45 | func (m *mockProvider) GetMeta(_ context.Context, _, _, commit string) (content.Meta, error) { |
| 46 | if m.byCommit != nil { |
nothing calls this directly
no outgoing calls
no test coverage detected