import { describe, it, expect } from 'vitest';
import { suggestRedirectTarget } from '../../redirects/suggest.js';
describe('suggestRedirectTarget', () => {
    const candidates = [
        { url: '/services/enterprise-plans', title: 'Enterprise Plans' },
        { url: '/about', title: 'About Us' },
        { url: '/blog/launch', title: 'Launch announcement' },
    ];
    it('matches a dead path to the most similar live URL', () => {
        const result = suggestRedirectTarget('/services/enterprise', candidates);
        expect(result).not.toBeNull();
        expect(result.toPath).toBe('/services/enterprise-plans');
        expect(result.confidence).toBeGreaterThan(30);
    });
    it('returns null when nothing clears the threshold', () => {
        const result = suggestRedirectTarget('/zzz-nothing-related', candidates, 40);
        expect(result).toBeNull();
    });
    it('returns null with no candidates', () => {
        expect(suggestRedirectTarget('/x', [])).toBeNull();
    });
    it('uses title similarity when path tokens are weak', () => {
        const result = suggestRedirectTarget('/launch-announcement', candidates);
        expect(result).not.toBeNull();
        expect(result.toPath).toBe('/blog/launch');
    });
});
//# sourceMappingURL=suggest.test.js.map