tusd/pkg/handler/subtest_test.go

28 lines
591 B
Go
Raw Permalink Normal View History

package handler_test
import (
"testing"
"github.com/tus/tusd/v2/pkg/handler"
"github.com/golang/mock/gomock"
)
func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataStore, *handler.StoreComposer)) {
t.Run(name, func(subT *testing.T) {
//subT.Parallel()
ctrl := gomock.NewController(subT)
defer ctrl.Finish()
store := NewMockFullDataStore(ctrl)
composer := handler.NewStoreComposer()
composer.UseCore(store)
composer.UseTerminater(store)
composer.UseConcater(store)
composer.UseLengthDeferrer(store)
runTest(subT, store, composer)
})
}