elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
403 stars 30 forks source link

Add Projections for LiveComponent and JSON View Controllers #80

Closed zolrath closed 1 year ago

zolrath commented 1 year ago

From what I can tell the JSON view controller can be fairly light and doesn't have the same level of structure as the HTML view controller, but I've added it as well as a Live Component projection!

mhanberg commented 1 year ago

I'd like to get some basic unit tests written for this and #85, but it'll require some test fixtures.

once the tests for #88 are written, we can rebase on main and then i can contribute them to this PR or you can take a crack at them if you'd like.

zolrath commented 1 year ago

Sounds good! I've never made tests for a neovim plugin but if you have examples of tests for other projections I can definitely add them as needed for the PR!

mhanberg commented 1 year ago

I'm sort of in the same boat, as the existing tests are more or less basic unit tests of lua code, whereas the tests i'd like to write for this actually make neovim do stuff.

mhanberg commented 1 year ago

Some test fixtures were just merged into main, so if you rebase you should be able to utilize them to write some tests

zolrath commented 1 year ago

Some test fixtures were just merged into main, so if you rebase you should be able to utilize them to write some tests

Okay great! Do you have an example of how you're running the current tests? Not quite sure how that's being orchestrated and it doesn't seem documented yet!

From what I can tell it's likely something akin to:

nvim --headless -c "PlenaryBustedDirectory tests/ {minimal_init = 'support/minimal_init.vim'}"

but it would be nice to be sure!

Seems like I'd need to independently have Plenary installed in my vim config for that?

mhanberg commented 1 year ago

There is a script in bin called test-local.

And yes plenary has to be in your config, but I believe the plug-in needs it so you should already have it.

mhanberg commented 1 year ago

@zolrath when https://github.com/elixir-tools/elixir-tools.nvim/pull/108 merges, you should have a foundation for adding projectionist tests.

you can run the tests with bin/test or bin/test path/to/file.

You should run this with >= 0.9 for it to work well.

I'm copy pasting this comment to your other PR