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, handle project.WatcherHandle) error
- func (mock *ClientMock) UnwatchFilesCalls() []struct{ ... }
- func (mock *ClientMock) WatchFiles(ctx context.Context, watchers []*lsproto.FileSystemWatcher) (project.WatcherHandle, error)
- func (mock *ClientMock) WatchFilesCalls() []struct{ ... }
- type ProjectServiceHost
- func (p *ProjectServiceHost) Client() project.Client
- func (p *ProjectServiceHost) DefaultLibraryPath() string
- func (p *ProjectServiceHost) FS() vfs.FS
- func (p *ProjectServiceHost) GetCurrentDirectory() string
- func (p *ProjectServiceHost) Log(msg ...any)
- func (p *ProjectServiceHost) NewLine() string
- func (p *ProjectServiceHost) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error)
- func (p *ProjectServiceHost) ReplaceFS(files map[string]any)
- func (p *ProjectServiceHost) TypingsLocation() string
- type TestTypingsInstaller
- type TestTypingsInstallerOptions
Constants ¶
const ( TestTypingsLocation = "/home/src/Library/Caches/typescript" TestLibLocation = "/home/src/tslibs/TS/Lib" )
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, handle project.WatcherHandle) error
// WatchFilesFunc mocks the WatchFiles method.
WatchFilesFunc func(ctx context.Context, watchers []*lsproto.FileSystemWatcher) (project.WatcherHandle, 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, handle project.WatcherHandle) error {
panic("mock out the UnwatchFiles method")
},
WatchFilesFunc: func(ctx context.Context, watchers []*lsproto.FileSystemWatcher) (project.WatcherHandle, 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 ¶
func (mock *ClientMock) UnwatchFiles(ctx context.Context, handle project.WatcherHandle) error
UnwatchFiles calls UnwatchFilesFunc.
func (*ClientMock) UnwatchFilesCalls ¶
func (mock *ClientMock) UnwatchFilesCalls() []struct { Ctx context.Context Handle project.WatcherHandle }
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, watchers []*lsproto.FileSystemWatcher) (project.WatcherHandle, error)
WatchFiles calls WatchFilesFunc.
func (*ClientMock) WatchFilesCalls ¶
func (mock *ClientMock) WatchFilesCalls() []struct { Ctx context.Context Watchers []*lsproto.FileSystemWatcher }
WatchFilesCalls gets all the calls that were made to WatchFiles. Check the length with:
len(mockedClient.WatchFilesCalls())
type ProjectServiceHost ¶
type ProjectServiceHost struct {
ClientMock *ClientMock
ServiceOptions *project.ServiceOptions
// contains filtered or unexported fields
}
func Setup ¶
func Setup(files map[string]any, testOptions *TestTypingsInstaller) (*project.Service, *ProjectServiceHost)
func (*ProjectServiceHost) Client ¶
func (p *ProjectServiceHost) Client() project.Client
Client implements project.ProjectServiceHost.
func (*ProjectServiceHost) DefaultLibraryPath ¶
func (p *ProjectServiceHost) DefaultLibraryPath() string
DefaultLibraryPath implements project.ProjectServiceHost.
func (*ProjectServiceHost) FS ¶
func (p *ProjectServiceHost) FS() vfs.FS
FS implements project.ProjectServiceHost.
func (*ProjectServiceHost) GetCurrentDirectory ¶
func (p *ProjectServiceHost) GetCurrentDirectory() string
GetCurrentDirectory implements project.ProjectServiceHost.
func (*ProjectServiceHost) Log ¶
func (p *ProjectServiceHost) Log(msg ...any)
Log implements project.ProjectServiceHost.
func (*ProjectServiceHost) NewLine ¶
func (p *ProjectServiceHost) NewLine() string
NewLine implements project.ProjectServiceHost.
func (*ProjectServiceHost) NpmInstall ¶
func (p *ProjectServiceHost) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error)
func (*ProjectServiceHost) ReplaceFS ¶
func (p *ProjectServiceHost) ReplaceFS(files map[string]any)
func (*ProjectServiceHost) TypingsLocation ¶
func (p *ProjectServiceHost) TypingsLocation() string
type TestTypingsInstaller ¶
type TestTypingsInstaller struct {
project.TypingsInstallerOptions
TestTypingsInstallerOptions
}