mocks

package
v1.0.1-0...-a7812af Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StoreMock

type StoreMock struct {
	// LoadFunc mocks the Load method.
	LoadFunc func(fmFeed string, max int, skipJunk bool) ([]feed.Item, error)
	// contains filtered or unexported fields
}

StoreMock is a mock implementation of api.Store.

func TestSomethingThatUsesStore(t *testing.T) {

	// make and configure a mocked api.Store
	mockedStore := &StoreMock{
		LoadFunc: func(fmFeed string, max int, skipJunk bool) ([]feed.Item, error) {
			panic("mock out the Load method")
		},
	}

	// use mockedStore in code that requires api.Store
	// and then make assertions.

}

func (*StoreMock) Load

func (mock *StoreMock) Load(fmFeed string, max int, skipJunk bool) ([]feed.Item, error)

Load calls LoadFunc.

func (*StoreMock) LoadCalls

func (mock *StoreMock) LoadCalls() []struct {
	FmFeed   string
	Max      int
	SkipJunk bool
}

LoadCalls gets all the calls that were made to Load. Check the length with:

len(mockedStore.LoadCalls())

type YoutubeSvcMock

type YoutubeSvcMock struct {
	// RSSFeedFunc mocks the RSSFeed method.
	RSSFeedFunc func(cinfo youtube.FeedInfo) (string, error)

	// RemoveEntryFunc mocks the RemoveEntry method.
	RemoveEntryFunc func(entry ytfeed.Entry) error

	// StoreRSSFunc mocks the StoreRSS method.
	StoreRSSFunc func(chanID string, rss string) error
	// contains filtered or unexported fields
}

YoutubeSvcMock is a mock implementation of api.YoutubeSvc.

func TestSomethingThatUsesYoutubeSvc(t *testing.T) {

	// make and configure a mocked api.YoutubeSvc
	mockedYoutubeSvc := &YoutubeSvcMock{
		RSSFeedFunc: func(cinfo youtube.FeedInfo) (string, error) {
			panic("mock out the RSSFeed method")
		},
		RemoveEntryFunc: func(entry ytfeed.Entry) error {
			panic("mock out the RemoveEntry method")
		},
		StoreRSSFunc: func(chanID string, rss string) error {
			panic("mock out the StoreRSS method")
		},
	}

	// use mockedYoutubeSvc in code that requires api.YoutubeSvc
	// and then make assertions.

}

func (*YoutubeSvcMock) RSSFeed

func (mock *YoutubeSvcMock) RSSFeed(cinfo youtube.FeedInfo) (string, error)

RSSFeed calls RSSFeedFunc.

func (*YoutubeSvcMock) RSSFeedCalls

func (mock *YoutubeSvcMock) RSSFeedCalls() []struct {
	Cinfo youtube.FeedInfo
}

RSSFeedCalls gets all the calls that were made to RSSFeed. Check the length with:

len(mockedYoutubeSvc.RSSFeedCalls())

func (*YoutubeSvcMock) RemoveEntry

func (mock *YoutubeSvcMock) RemoveEntry(entry ytfeed.Entry) error

RemoveEntry calls RemoveEntryFunc.

func (*YoutubeSvcMock) RemoveEntryCalls

func (mock *YoutubeSvcMock) RemoveEntryCalls() []struct {
	Entry ytfeed.Entry
}

RemoveEntryCalls gets all the calls that were made to RemoveEntry. Check the length with:

len(mockedYoutubeSvc.RemoveEntryCalls())

func (*YoutubeSvcMock) StoreRSS

func (mock *YoutubeSvcMock) StoreRSS(chanID string, rss string) error

StoreRSS calls StoreRSSFunc.

func (*YoutubeSvcMock) StoreRSSCalls

func (mock *YoutubeSvcMock) StoreRSSCalls() []struct {
	ChanID string
	Rss    string
}

StoreRSSCalls gets all the calls that were made to StoreRSS. Check the length with:

len(mockedYoutubeSvc.StoreRSSCalls())

Jump to

Keyboard shortcuts

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