Parent directory

feedparser.go

1874 bytes
 1// Code generated by moq; DO NOT EDIT.
 2// github.com/matryer/moq
 3
 4package parser_mock
 5
 6import (
 7	"github.com/TheEdgeOfRage/ytrssil-api/feedparser"
 8	"sync"
 9)
10
11// Ensure, that ParserMock does implement feedparser.Parser.
12// If this is not the case, regenerate this file with moq.
13var _ feedparser.Parser = &ParserMock{}
14
15// ParserMock is a mock implementation of feedparser.Parser.
16//
17//	func TestSomethingThatUsesParser(t *testing.T) {
18//
19//		// make and configure a mocked feedparser.Parser
20//		mockedParser := &ParserMock{
21//			ParseFunc: func(channelID string) (*feedparser.Channel, error) {
22//				panic("mock out the Parse method")
23//			},
24//		}
25//
26//		// use mockedParser in code that requires feedparser.Parser
27//		// and then make assertions.
28//
29//	}
30type ParserMock struct {
31	// ParseFunc mocks the Parse method.
32	ParseFunc func(channelID string) (*feedparser.Channel, error)
33
34	// calls tracks calls to the methods.
35	calls struct {
36		// Parse holds details about calls to the Parse method.
37		Parse []struct {
38			// ChannelID is the channelID argument value.
39			ChannelID string
40		}
41	}
42	lockParse sync.RWMutex
43}
44
45// Parse calls ParseFunc.
46func (mock *ParserMock) Parse(channelID string) (*feedparser.Channel, error) {
47	if mock.ParseFunc == nil {
48		panic("ParserMock.ParseFunc: method is nil but Parser.Parse was just called")
49	}
50	callInfo := struct {
51		ChannelID string
52	}{
53		ChannelID: channelID,
54	}
55	mock.lockParse.Lock()
56	mock.calls.Parse = append(mock.calls.Parse, callInfo)
57	mock.lockParse.Unlock()
58	return mock.ParseFunc(channelID)
59}
60
61// ParseCalls gets all the calls that were made to Parse.
62// Check the length with:
63//
64//	len(mockedParser.ParseCalls())
65func (mock *ParserMock) ParseCalls() []struct {
66	ChannelID string
67} {
68	var calls []struct {
69		ChannelID string
70	}
71	mock.lockParse.RLock()
72	calls = mock.calls.Parse
73	mock.lockParse.RUnlock()
74	return calls
75}