bump jest and make tests pass

This commit is contained in:
Louis Hache
2020-11-13 19:11:55 +01:00
parent d28dc26fa3
commit 4f58d166b7
5769 changed files with 856618 additions and 394571 deletions
+21 -6
View File
@@ -16,7 +16,6 @@
/* eslint import/no-extraneous-dependencies: "off" */
const Benchmark = require('benchmark');
const diffBaseline = require('diff').diffLines;
const diffImproved = require('../build/index.js').default;
@@ -39,7 +38,7 @@ const testBaseline = (a, b) => {
return benchmark.stats;
};
const testImproved = function(a, b) {
const testImproved = function (a, b) {
const benchmark = new Benchmark({
fn() {
// Split string arguments to make fair comparison with baseline.
@@ -140,12 +139,28 @@ const testLength = n => {
writeHeading3(n);
[2, 4, 8].forEach(tenth => {
testDeleteInsert(tenth, all, getItems(n, i => i % 10 >= tenth && `${i}`));
testDeleteInsert(
tenth,
all,
getItems(n, i => i % 10 >= tenth && `${i}`),
);
});
testChange(1, all, getItems(n, i => (i % 10 === 0 ? `x${i}` : `${i}`)));
testChange(
1,
all,
getItems(n, i => (i % 10 === 0 ? `x${i}` : `${i}`)),
);
testChange(2, all, getItems(n, change2));
testChange(5, all, getItems(n, i => (i % 2 === 0 ? `x${i}` : `${i}`)));
testChange(10, all, getItems(n, i => `x${i}`)); // simulate TDD
testChange(
5,
all,
getItems(n, i => (i % 2 === 0 ? `x${i}` : `${i}`)),
);
testChange(
10,
all,
getItems(n, i => `x${i}`),
); // simulate TDD
};
writeHeading2();