import { describe, expect, it } from 'vitest';
import { matchPathToCollection } from '../../seo/resolve-path.js';
const config = {
    collections: {
        pages: { slug: 'pages', type: 'page' },
        posts: { slug: 'posts', type: 'post', urlPrefix: '/blog' },
    },
};
describe('matchPathToCollection', () => {
    it('resolves the root path to the prefix-less page collection home', () => {
        expect(matchPathToCollection(config, '/')).toEqual({
            collection: 'pages',
            slug: 'home',
            isRoot: true,
        });
    });
    it('resolves a single segment to the page collection', () => {
        expect(matchPathToCollection(config, '/about')).toEqual({
            collection: 'pages',
            slug: 'about',
            isRoot: false,
        });
    });
    it('resolves a prefixed path to the matching collection', () => {
        expect(matchPathToCollection(config, '/blog/my-post')).toEqual({
            collection: 'posts',
            slug: 'my-post',
            isRoot: false,
        });
    });
    it('tolerates leading/trailing slashes', () => {
        expect(matchPathToCollection(config, 'about/')).toEqual({
            collection: 'pages',
            slug: 'about',
            isRoot: false,
        });
    });
    it('falls back to <collection>/<slug> for unknown multi-segment paths', () => {
        expect(matchPathToCollection({ collections: {} }, '/things/x')).toEqual({
            collection: 'things',
            slug: 'x',
            isRoot: false,
        });
    });
});
//# sourceMappingURL=resolve-path.test.js.map