Documentation
¶
Index ¶
- Constants
- func TypesRegistryConfig() map[string]string
- func TypesRegistryConfigText() string
- func WithRequestID(ctx context.Context) context.Context
- type ClientMock
- func (mock *ClientMock) RefreshDiagnostics(ctx context.Context) error
- func (mock *ClientMock) RefreshDiagnosticsCalls() []struct{ ... }
- func (mock *ClientMock) UnwatchFiles(ctx context.Context, id project.WatcherID) error
- func (mock *ClientMock) UnwatchFilesCalls() []struct{ ... }
- func (mock *ClientMock) WatchFiles(ctx context.Context, id project.WatcherID, ...) error
- func (mock *ClientMock) WatchFilesCalls() []struct{ ... }
- type NpmExecutorMock
- type SessionUtils
- func Setup(files map[string]any) (*project.Session, *SessionUtils)
- func SetupWithOptions(files map[string]any, options *project.SessionOptions) (*project.Session, *SessionUtils)
- func SetupWithOptionsAndTypingsInstaller(files map[string]any, options *project.SessionOptions, ...) (*project.Session, *SessionUtils)
- func SetupWithTypingsInstaller(files map[string]any, tiOptions *TypingsInstallerOptions) (*project.Session, *SessionUtils)
- type TypingsInstallerOptions
Constants ¶
View Source
const (
TestTypingsLocation = "/home/src/Library/Caches/typescript"
)
Variables ¶
This section is empty.
Functions ¶
func TypesRegistryConfig ¶
func TypesRegistryConfigText ¶
func TypesRegistryConfigText() string
Types ¶
type ClientMock ¶
type ClientMock struct {
// RefreshDiagnosticsFunc mocks the RefreshDiagnostics method.
RefreshDiagnosticsFunc func(ctx context.Context) error
// UnwatchFilesFunc mocks the UnwatchFiles method.
UnwatchFilesFunc func(ctx context.Context, id project.WatcherID) error
// WatchFilesFunc mocks the WatchFiles method.
WatchFilesFunc func(ctx context.Context, id project.WatcherID, watchers []*lsproto.FileSystemWatcher) error
// contains filtered or unexported fields
}
ClientMock is a mock implementation of project.Client.
func TestSomethingThatUsesClient(t *testing.T) {
// make and configure a mocked project.Client
mockedClient := &ClientMock{
RefreshDiagnosticsFunc: func(ctx context.Context) error {
panic("mock out the RefreshDiagnostics method")
},
UnwatchFilesFunc: func(ctx context.Context, id project.WatcherID) error {
panic("mock out the UnwatchFiles method")
},
WatchFilesFunc: func(ctx context.Context, id project.WatcherID, watchers []*lsproto.FileSystemWatcher) error {
panic("mock out the WatchFiles method")
},
}
// use mockedClient in code that requires project.Client
// and then make assertions.
}
func (*ClientMock) RefreshDiagnostics ¶
func (mock *ClientMock) RefreshDiagnostics(ctx context.Context) error
RefreshDiagnostics calls RefreshDiagnosticsFunc.
func (*ClientMock) RefreshDiagnosticsCalls ¶
func (mock *ClientMock) RefreshDiagnosticsCalls() []struct { Ctx context.Context }
RefreshDiagnosticsCalls gets all the calls that were made to RefreshDiagnostics. Check the length with:
len(mockedClient.RefreshDiagnosticsCalls())
func (*ClientMock) UnwatchFiles ¶
UnwatchFiles calls UnwatchFilesFunc.
func (*ClientMock) UnwatchFilesCalls ¶
func (mock *ClientMock) UnwatchFilesCalls() []struct { Ctx context.Context ID project.WatcherID }
UnwatchFilesCalls gets all the calls that were made to UnwatchFiles. Check the length with:
len(mockedClient.UnwatchFilesCalls())
func (*ClientMock) WatchFiles ¶
func (mock *ClientMock) WatchFiles(ctx context.Context, id project.WatcherID, watchers []*lsproto.FileSystemWatcher) error
WatchFiles calls WatchFilesFunc.
func (*ClientMock) WatchFilesCalls ¶
func (mock *ClientMock) WatchFilesCalls() []struct { Ctx context.Context ID project.WatcherID Watchers []*lsproto.FileSystemWatcher }
WatchFilesCalls gets all the calls that were made to WatchFiles. Check the length with:
len(mockedClient.WatchFilesCalls())
type NpmExecutorMock ¶
type NpmExecutorMock struct {
// NpmInstallFunc mocks the NpmInstall method.
NpmInstallFunc func(cwd string, args []string) ([]byte, error)
// contains filtered or unexported fields
}
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.
}
func (*NpmExecutorMock) NpmInstall ¶
func (mock *NpmExecutorMock) NpmInstall(cwd string, args []string) ([]byte, error)
NpmInstall calls NpmInstallFunc.
func (*NpmExecutorMock) NpmInstallCalls ¶
func (mock *NpmExecutorMock) NpmInstallCalls() []struct { Cwd string Args []string }
NpmInstallCalls gets all the calls that were made to NpmInstall. Check the length with:
len(mockedNpmExecutor.NpmInstallCalls())
type SessionUtils ¶
type SessionUtils struct {
// contains filtered or unexported fields
}
func SetupWithOptions ¶
func SetupWithOptions(files map[string]any, options *project.SessionOptions) (*project.Session, *SessionUtils)
func SetupWithOptionsAndTypingsInstaller ¶
func SetupWithOptionsAndTypingsInstaller(files map[string]any, options *project.SessionOptions, tiOptions *TypingsInstallerOptions) (*project.Session, *SessionUtils)
func SetupWithTypingsInstaller ¶
func SetupWithTypingsInstaller(files map[string]any, tiOptions *TypingsInstallerOptions) (*project.Session, *SessionUtils)
func (*SessionUtils) BaselineLogs ¶
func (h *SessionUtils) BaselineLogs(t *testing.T)
func (*SessionUtils) Client ¶
func (h *SessionUtils) Client() *ClientMock
func (*SessionUtils) FS ¶
func (h *SessionUtils) FS() vfs.FS
func (*SessionUtils) Logs ¶
func (h *SessionUtils) Logs() string
func (*SessionUtils) NpmExecutor ¶
func (h *SessionUtils) NpmExecutor() *NpmExecutorMock
func (*SessionUtils) SetupNpmExecutorForTypingsInstaller ¶
func (h *SessionUtils) SetupNpmExecutorForTypingsInstaller()
type TypingsInstallerOptions ¶
Click to show internal directories.
Click to hide internal directories.