mock

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankAPIMock

type BankAPIMock struct {
	// GetTransactionsFunc mocks the GetTransactions method.
	GetTransactionsFunc func(ctx context.Context, query mono.GetTransactionsQuery) ([]mono.Transaction, error)
	// contains filtered or unexported fields
}

BankAPIMock is a mock implementation of BankAPI.

    func TestSomethingThatUsesBankAPI(t *testing.T) {

        // make and configure a mocked BankAPI
        mockedBankAPI := &BankAPIMock{
            GetTransactionsFunc: func(ctx context.Context, query mono.GetTransactionsQuery) ([]mono.Transaction, error) {
	               panic("mock out the GetTransactions method")
            },
        }

        // use mockedBankAPI in code that requires BankAPI
        // and then make assertions.

    }

func (*BankAPIMock) GetTransactions

func (mock *BankAPIMock) GetTransactions(ctx context.Context, query mono.GetTransactionsQuery) ([]mono.Transaction, error)

GetTransactions calls GetTransactionsFunc.

func (*BankAPIMock) GetTransactionsCalls

func (mock *BankAPIMock) GetTransactionsCalls() []struct {
	Ctx   context.Context
	Query mono.GetTransactionsQuery
}

GetTransactionsCalls gets all the calls that were made to GetTransactions. Check the length with:

len(mockedBankAPI.GetTransactionsCalls())

type ImportIntervalGeneratorMock

type ImportIntervalGeneratorMock struct {
	// GetIntervalFunc mocks the GetInterval method.
	GetIntervalFunc func(ctx context.Context, accountID string) (time.Time, time.Time, error)
	// contains filtered or unexported fields
}

ImportIntervalGeneratorMock is a mock implementation of ImportIntervalGenerator.

    func TestSomethingThatUsesImportIntervalGenerator(t *testing.T) {

        // make and configure a mocked ImportIntervalGenerator
        mockedImportIntervalGenerator := &ImportIntervalGeneratorMock{
            GetIntervalFunc: func(ctx context.Context, accountID string) (time.Time, time.Time, error) {
	               panic("mock out the GetInterval method")
            },
        }

        // use mockedImportIntervalGenerator in code that requires ImportIntervalGenerator
        // and then make assertions.

    }

func (*ImportIntervalGeneratorMock) GetInterval

func (mock *ImportIntervalGeneratorMock) GetInterval(ctx context.Context, accountID string) (time.Time, time.Time, error)

GetInterval calls GetIntervalFunc.

func (*ImportIntervalGeneratorMock) GetIntervalCalls

func (mock *ImportIntervalGeneratorMock) GetIntervalCalls() []struct {
	Ctx       context.Context
	AccountID string
}

GetIntervalCalls gets all the calls that were made to GetInterval. Check the length with:

len(mockedImportIntervalGenerator.GetIntervalCalls())

type StorageMock

type StorageMock struct {
	// SaveFunc mocks the Save method.
	SaveFunc func(ctx context.Context, transactions []transaction2.Transaction) error
	// contains filtered or unexported fields
}

StorageMock is a mock implementation of Storage.

    func TestSomethingThatUsesStorage(t *testing.T) {

        // make and configure a mocked Storage
        mockedStorage := &StorageMock{
            SaveFunc: func(ctx context.Context, transactions []storage.Transaction) error {
	               panic("mock out the Save method")
            },
        }

        // use mockedStorage in code that requires Storage
        // and then make assertions.

    }

func (*StorageMock) Save

func (mock *StorageMock) Save(ctx context.Context, transactions []transaction2.Transaction) error

Save calls SaveFunc.

func (*StorageMock) SaveCalls

func (mock *StorageMock) SaveCalls() []struct {
	Ctx          context.Context
	Transactions []transaction2.Transaction
}

SaveCalls gets all the calls that were made to Save. Check the length with:

len(mockedStorage.SaveCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL