import { describe } from './_harness.mjs';
import { rank } from '../../../src/core/score.mjs';
describe('score', (it)=>{
const ranked = rank('alpha beta', [
{ headingPath:'H1', text:'alpha x y'},
{ headingPath:'H1 > H2', text:'beta alpha'},
{ headingPath:'H1', text:'gamma'}
]);
it('higher score first', ()=>{
if(ranked[0].score < ranked[1].score) throw new Error('ordering incorrect');
});
it('tie broken by shallower depth', ()=>{
const tie = rank('alpha', [
{ headingPath:'H1 > H2', text:'alpha'},
{ headingPath:'H1', text:'alpha'}
]);
if(!tie[0].headingPath.startsWith('H1')) throw new Error('shallower not first');
});
});