import { describe, expect, it } from 'vitest';
import { detectBrokenInternalLinks } from '../../seo/audit-signals.js';
const home = {
    entityType: 'page',
    entityId: 'home',
    title: 'Home',
    url: '/',
    content: '<p>Welcome <a href="/about">About</a></p>',
    metaTitle: 'Home',
    metaDescription: 'Welcome home page with enough characters to pass the minimum length check for meta descriptions in search.',
    canonicalUrl: 'https://example.com/',
};
describe('detectBrokenInternalLinks', () => {
    it('flags internal links that do not match known pages', () => {
        const broken = detectBrokenInternalLinks([home, { ...home, entityId: 'about', url: '/about', content: '' }], { siteUrl: 'https://example.com' });
        expect(broken).toHaveLength(0);
        const missing = detectBrokenInternalLinks([home], { siteUrl: 'https://example.com' });
        expect(missing).toHaveLength(1);
        expect(missing[0].url).toBe('/about');
        expect(missing[0].fromEntityId).toBe('home');
    });
    it('accepts targets reachable via redirect rules', () => {
        const broken = detectBrokenInternalLinks([home], {
            siteUrl: 'https://example.com',
            redirectRules: [{ id: '1', from: '/about', to: '/', enabled: true }],
        });
        expect(broken).toHaveLength(0);
    });
});
//# sourceMappingURL=audit-signals.test.js.map