Algorithms-Leetcode-Javascript
Algorithms-Leetcode-Javascript copied to clipboard
Idea: throw a unit test error if the problem doesn't have a test file nor an entry on the readme
We often have to request changes to PRs due to tests not being present or an entry to the readme isn't added.
I suggest we create a unit test that:
1- reads all the problem names and asserts there is a file for testing. We can do that by inspecting the problem's name and asserting there is a corresponding ${file_name}_test
name with assert_
methods.
1- Reads the README and asserts there is a link to the problem created. This one is less important than the previous one.
Thoughts @hot9cups ?
Hm, that is actually a good idea.
To achieve 1, we'd essentially have to do basically an assert that xyzTest.js file exists
logic which doesn't seem so hard.
To achieve 2, we would need to do a regex match for example for the link which shouldn't be bad either.
The only thing to check maybe then is to confirm that all our files already follow this convention of ${file_name}_test
strictly. They most probably already do so we should be good here.
Hm, yes I agree this would be beneficial to add, nice job for coming up with the idea