From 218840f9b5b1ff6b1cc4a57c42f8539a6d5b6601 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Thu, 30 May 2024 12:42:43 +0200 Subject: [PATCH] feat(IMEX-9): introduce a typedef to be able to mock ImportMessages. --- message_import.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/message_import.go b/message_import.go index f0d8321..592ece2 100644 --- a/message_import.go +++ b/message_import.go @@ -26,7 +26,9 @@ const ( var ErrImportEncrypt = errors.New("failed to encrypt message") var ErrImportSizeExceeded = errors.New("message exceeds maximum import size of 30MB") -func (c *Client) ImportMessages(ctx context.Context, addrKR *crypto.KeyRing, workers, buffer int, req ...ImportReq) (stream.Stream[ImportRes], error) { +type ImportResStream stream.Stream[ImportRes] // gomock does not support generics. In order to be able to mock ImportMessages, we introduce a typedef. + +func (c *Client) ImportMessages(ctx context.Context, addrKR *crypto.KeyRing, workers, buffer int, req ...ImportReq) (ImportResStream, error) { // Encrypt each message. for idx := range req { enc, err := EncryptRFC822(addrKR, req[idx].Message)