import { describe, it, expect } from 'vitest';
// Copy of the internal stripBase function for testing
function stripBase(pathname, basePath) {
    if (pathname.startsWith(basePath)) {
        const rest = pathname.slice(basePath.length);
        return rest === '' || rest === '/' ? '/' : rest.startsWith('/') ? rest : `/${rest}`;
    }
    return '/';
}
describe('stripBase', () => {
    it('strips the base path and returns the remainder with a leading slash', () => {
        expect(stripBase('/admin/dashboard', '/admin')).toBe('/dashboard');
        expect(stripBase('/admin/collections/posts', '/admin')).toBe('/collections/posts');
    });
    it('returns root when the pathname is exactly the base or base plus trailing slash', () => {
        expect(stripBase('/admin', '/admin')).toBe('/');
        expect(stripBase('/admin/', '/admin')).toBe('/');
    });
    it('returns root when the pathname does not start with the base path', () => {
        expect(stripBase('/public/page', '/admin')).toBe('/');
    });
    it('normalizes remainder that lacks a leading slash', () => {
        expect(stripBase('/adminfoo', '/admin')).toBe('/foo');
    });
});
//# sourceMappingURL=strip-base.test.js.map