Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Dec 7, 2023
1 parent aa41635 commit 26b7df4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,44 @@ const serve = () => {

};

const testFunctions = () => {


const { dedupeRanges } = require('../lib/converter/dedupe.js');

const ranges = [{
start: 0, end: 10
}, {
start: 100, end: 200
}, {
start: 0, end: 15
}, {
start: 20, end: 30
}, {
start: 18, end: 25
}, {
start: 50, end: 60
}, {
start: 55, end: 58
}, {
start: 58, end: 66
}, {
start: 50, end: 80
}, {
start: 30, end: 50
}];
const newRanges = dedupeRanges(ranges);
console.log(newRanges);

console.assert(JSON.stringify(newRanges) === '[{"start":0,"end":15},{"start":18,"end":80},{"start":100,"end":200}]');
console.log(EC.green('passed'), 'test dedupeRanges');

};

const test = async () => {

testFunctions();

console.log('start server ...');
const server = await serve();

Expand Down

0 comments on commit 26b7df4

Please sign in to comment.