kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

Introduce unit tests #191

Closed b-camphart closed 10 months ago

b-camphart commented 10 months ago

The goal of this PR is to introduce the vitest framework for unit testing. It'll be difficult to unit test everything, since, by nature, the plugin depends on the obsidian API, which isn't available during testing. But, some important, finicky bits of functionality can be extracted, where appropriate, and some unit tests can be made for them. This PR introduces one example of where it would be beneficial to have unit tests.

The tests, right now, are failing because I haven't yet updated the production code to fix #189. I figure, if you're OK with introducing the test framework, then that bug can be fixed in another PR.

b-camphart commented 10 months ago

Also, I chose vitest instead of jest because, in my experience, vitest is just so much faster. Even though it's actually built on top of jest, it somehow runs much better.