Add selectAccounts filter and accountIDs param to orchestrator.Run
This commit is contained in:
@@ -22,3 +22,23 @@ func TestGateOK(t *testing.T) {
|
||||
t.Fatal("empty accounts must fail gate")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectAccounts(t *testing.T) {
|
||||
accs := []store.Account{{ID: 1}, {ID: 2}, {ID: 3}}
|
||||
|
||||
if got := selectAccounts(accs, nil); len(got) != 3 {
|
||||
t.Fatalf("nil ids must return all, got %d", len(got))
|
||||
}
|
||||
if got := selectAccounts(accs, []int64{}); len(got) != 3 {
|
||||
t.Fatalf("empty ids must return all, got %d", len(got))
|
||||
}
|
||||
|
||||
got := selectAccounts(accs, []int64{3, 1})
|
||||
if len(got) != 2 || got[0].ID != 1 || got[1].ID != 3 {
|
||||
t.Fatalf("must keep matching ids in input order, got %+v", got)
|
||||
}
|
||||
|
||||
if got := selectAccounts(accs, []int64{99}); len(got) != 0 {
|
||||
t.Fatalf("unknown ids must yield empty, got %d", len(got))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user