kittenipc/kitcom/internal/tsgo/testutil/projecttestutil/npmexecutormock_generated.go
2025-10-15 10:12:44 +03:00

87 lines
2.1 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package projecttestutil
import (
"sync"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/project/ata"
)
// Ensure, that NpmExecutorMock does implement ata.NpmExecutor.
// If this is not the case, regenerate this file with moq.
var _ ata.NpmExecutor = &NpmExecutorMock{}
// NpmExecutorMock is a mock implementation of ata.NpmExecutor.
//
// func TestSomethingThatUsesNpmExecutor(t *testing.T) {
//
// // make and configure a mocked ata.NpmExecutor
// mockedNpmExecutor := &NpmExecutorMock{
// NpmInstallFunc: func(cwd string, args []string) ([]byte, error) {
// panic("mock out the NpmInstall method")
// },
// }
//
// // use mockedNpmExecutor in code that requires ata.NpmExecutor
// // and then make assertions.
//
// }
type NpmExecutorMock struct {
// NpmInstallFunc mocks the NpmInstall method.
NpmInstallFunc func(cwd string, args []string) ([]byte, error)
// calls tracks calls to the methods.
calls struct {
// NpmInstall holds details about calls to the NpmInstall method.
NpmInstall []struct {
// Cwd is the cwd argument value.
Cwd string
// Args is the args argument value.
Args []string
}
}
lockNpmInstall sync.RWMutex
}
// NpmInstall calls NpmInstallFunc.
func (mock *NpmExecutorMock) NpmInstall(cwd string, args []string) ([]byte, error) {
callInfo := struct {
Cwd string
Args []string
}{
Cwd: cwd,
Args: args,
}
mock.lockNpmInstall.Lock()
mock.calls.NpmInstall = append(mock.calls.NpmInstall, callInfo)
mock.lockNpmInstall.Unlock()
if mock.NpmInstallFunc == nil {
var (
bytesOut []byte
errOut error
)
return bytesOut, errOut
}
return mock.NpmInstallFunc(cwd, args)
}
// NpmInstallCalls gets all the calls that were made to NpmInstall.
// Check the length with:
//
// len(mockedNpmExecutor.NpmInstallCalls())
func (mock *NpmExecutorMock) NpmInstallCalls() []struct {
Cwd string
Args []string
} {
var calls []struct {
Cwd string
Args []string
}
mock.lockNpmInstall.RLock()
calls = mock.calls.NpmInstall
mock.lockNpmInstall.RUnlock()
return calls
}