@@ -94,7 +94,6 @@ func TestLoader(t *testing.T) {
9494 ctx := context .Background ()
9595 future := loader .LoadMany (ctx , []interface {}{"1" , "2" , "3" })
9696 _ , err := future ()
97- log .Printf ("errs: %#v" , err )
9897 if len (err ) != 3 {
9998 t .Errorf ("LoadMany didn't return right number of errors (should match size of input)" )
10099 }
@@ -108,6 +107,16 @@ func TestLoader(t *testing.T) {
108107 }
109108 })
110109
110+ t .Run ("test LoadMany returns nil []error when no errors occurred" , func (t * testing.T ) {
111+ t .Parallel ()
112+ loader , _ := IDLoader (0 )
113+ ctx := context .Background ()
114+ _ , err := loader .LoadMany (ctx , []interface {}{"1" , "2" , "3" })()
115+ if err != nil {
116+ t .Errorf ("Expected LoadMany() to return nil error slice when no errors occurred" )
117+ }
118+ })
119+
111120 t .Run ("test thunkmany does not contain race conditions" , func (t * testing.T ) {
112121 t .Parallel ()
113122 identityLoader , _ := IDLoader (0 )
@@ -491,7 +500,7 @@ func OneErrorLoader(max int) (*Loader, *[][]interface{}) {
491500 var mu sync.Mutex
492501 var loadCalls [][]interface {}
493502 identityLoader := NewBatchedLoader (func (_ context.Context , keys []interface {}) []* Result {
494- results := make ([]* Result , max , max )
503+ results := make ([]* Result , max )
495504 mu .Lock ()
496505 loadCalls = append (loadCalls , keys )
497506 mu .Unlock ()
0 commit comments