backbone.marionette icon indicating copy to clipboard operation
backbone.marionette copied to clipboard

Clean up tests

Open paulfalgout opened this issue 7 years ago • 10 comments

Looking over the tests many of them use older terms (some even Marionette v1). There are a few tests that were modified to match the current behavior, but aren't in fact testing anything anymore. And in general the tests could be updated to be cleaner and more consistent.

Further I believe most of the tests should be organized by class and then by either a feature of that class or an integration with a mixin or other class. We have too many one-off test files that it is difficult to tell where to add something.

I'll be playing with organization and style of tests while writing new ones for https://github.com/marionettejs/backbone.marionette/pull/3244 while examining what is currently there. I just want to be thinking about what improvements can be made.

Additionally there's a Readme file in the test directory that is completely irrelevant to our current setup. 😞

paulfalgout avatar Nov 02 '16 14:11 paulfalgout

As mentioned above https://github.com/marionettejs/backbone.marionette/pull/3244/commits/5603b0eb551cd43e9daaff69e0dc8a7682e4369b

paulfalgout avatar Nov 04 '16 18:11 paulfalgout

I agree with this, I think a clean up outline is in order. @denar90 is tackling Application There are so many test, I don't know where to start.

rafde avatar Nov 08 '16 06:11 rafde

@rafde moreover, I'm working with behaviors also.

denar90 avatar Nov 08 '16 06:11 denar90

I think the best way to approach this work might be to start testing the things with the least amount of dependencies. So I'd think we could make a utils directory (just have the test folder structure mirror the src) and make a unit test for each file... most likely by pulling from and updating older tests.. I think we can possibly ignore CollectionView, CompositeView, and AppRouter stuff for now. We definitely won't want to get rid of anything until we know there's a test that covers the same case.

paulfalgout avatar Nov 10 '16 05:11 paulfalgout

Sounds really good 👍 . It will be easy to find test file if it be a mirror of src folder. In addition, starting with behaviors was just experiment how it can goes, importing stuff from src etc.

denar90 avatar Nov 10 '16 06:11 denar90

I think for large classes with lots of integrations we can break up the tests into multiple files, but they can be put in a folder that matches the file name. live view/view.spec.js view/view-ui.spec.js view/view-behaviors.spec.js etc.

paulfalgout avatar Nov 10 '16 06:11 paulfalgout

Some of the specs could probably be renamed also, like https://github.com/rafde/backbone.marionette/blob/e887d160ea8df451f36bd8474b17edd59648b14e/test/unit/view.triggers.spec.js#L1-L1 is actually testing from view.$el.trigger

rafde avatar Nov 10 '16 06:11 rafde

SGTM

denar90 avatar Nov 10 '16 06:11 denar90

Maybe we should make a project for this? I've never tried it.

paulfalgout avatar Feb 14 '17 16:02 paulfalgout

I tried to do that here we are https://github.com/marionettejs/backbone.marionette/projects/1 🎉

denar90 avatar Feb 16 '17 23:02 denar90