Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose finder for tests #211

Open
pravinchandar opened this issue Apr 17, 2024 · 0 comments
Open

expose finder for tests #211

pravinchandar opened this issue Apr 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pravinchandar
Copy link

Describe the bug

The example here could be wrong?

I am not sure if its possible to test Find() without exposing the finder that is intialised during UseMockedTerminalV2()

go-fuzzyfinder/mock.go

Lines 265 to 270 in 8b4601d

// UseMockedTerminalV2 switches the terminal, which is used from
// this package to a mocked one.
func UseMockedTerminalV2() *TerminalMock {
f := newFinder()
return f.UseMockedTerminalV2()
}

I notice in all find tests in the code base that finder is exposed with the helper func.

func NewWithMockedTerminal() (*finder, *TerminalMock) {
eventsChan := make(chan tcell.Event, 10)
f := New()
f.termEventsChan = eventsChan
m := f.UseMockedTerminalV2()
go m.ChannelEvents(eventsChan, nil)
w, h := 60, 10 // A normally value.
m.SetSize(w, h)
return f, m
}

To reproduce

Expected behavior

Screenshots

Environment

  • OS:
  • Terminal:
  • go-fuzzyfinder version:

Additional context

@pravinchandar pravinchandar added the bug Something isn't working label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant