I am trying to test a suite of testing functions with a file structure like so:
- sorting
- algorithm
- bubble.js
- insertion.js
- test
- test.spec.js
each sort.js
file looks something like this:
var mergeSort = function(A) {
// ... implementation
}
module.exports = { mergeSort };
what is the best way for me to include all of these inside of test.spec.js
, and run the same tests on all of them? currently I am basically just doing tests like this (for linked-list)
describe('Stringify', function () {
let list1 = new LinkedList();
it('adds, removes, stringifies', function () {
expect(list1.stringify()).toEqual('');
list1.insertToBeginning(1);
expect(list1.stringify()).toEqual('1');
list1.insertToBeginning(1);
list1.insertToBeginning(2);
list1.insertToBeginning(3);
expect(list1.stringify()).toEqual('1');
});
});
but this will be too much for testing a suite of potentially many sorting algorithms. I would like to specify a bunch of tests, and run them all on the list of functions that I require
.
Aucun commentaire:
Enregistrer un commentaire