youtubemocks

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 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 APIMock

type APIMock struct {
	// VideoTitleFunc mocks the VideoTitle method.
	VideoTitleFunc func(ctx context.Context, u *url.URL) string
	// contains filtered or unexported fields
}

APIMock is a mock implementation of youtube.API.

func TestSomethingThatUsesAPI(t *testing.T) {

	// make and configure a mocked youtube.API
	mockedAPI := &APIMock{
		VideoTitleFunc: func(ctx context.Context, u *url.URL) string {
			panic("mock out the VideoTitle method")
		},
	}

	// use mockedAPI in code that requires youtube.API
	// and then make assertions.

}

func (*APIMock) VideoTitle

func (mock *APIMock) VideoTitle(ctx context.Context, u *url.URL) string

VideoTitle calls VideoTitleFunc.

func (*APIMock) VideoTitleCalls

func (mock *APIMock) VideoTitleCalls() []struct {
	Ctx context.Context
	U   *url.URL
}

VideoTitleCalls gets all the calls that were made to VideoTitle. Check the length with:

len(mockedAPI.VideoTitleCalls())

Jump to

Keyboard shortcuts

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