github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/test/patch_modules/applet.go (about)

     1  package patch_modules
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/agiledragon/gomonkey/v2"
     7  
     8  	"github.com/machinefi/w3bstream/pkg/depends/base/types"
     9  	"github.com/machinefi/w3bstream/pkg/modules/applet"
    10  )
    11  
    12  func AppletRemoveBySFID(patch *gomonkey.Patches, err error) *gomonkey.Patches {
    13  	return patch.ApplyFunc(
    14  		applet.RemoveBySFID,
    15  		func(_ context.Context, _ types.SFID) error { return err },
    16  	)
    17  }
    18  
    19  func AppletList(patch *gomonkey.Patches, rsp *applet.ListRsp, err error) *gomonkey.Patches {
    20  	return patch.ApplyFunc(
    21  		applet.List,
    22  		func(_ context.Context, _ *applet.ListReq) (*applet.ListRsp, error) {
    23  			return rsp, err
    24  		},
    25  	)
    26  }