Files
klz-cables.com/.pnpm-store/v10/files/28/c54a545707aef5a2ff402a6a80e3ccda7d013efcb002e156e436d5aa045692373b6332441c836c3cf7e92b4e34e7ce10ff360b096710d564a3dca2af7b8063
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

40 lines
1.4 KiB
Plaintext

import { describe, expect, it } from 'vitest';
import { withPayload } from './withPayload.js';
describe('withPayload', () => {
it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {
const originalBasePath = process.env.NEXT_BASE_PATH;
delete process.env.NEXT_BASE_PATH;
try {
const mockNextConfig = {
basePath: '/test/basepath'
};
withPayload(mockNextConfig);
// Verify it set the env var so formatAdminURL can read it
expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath');
} finally {
// Restore original value
if (originalBasePath === undefined) {
delete process.env.NEXT_BASE_PATH;
} else {
process.env.NEXT_BASE_PATH = originalBasePath;
}
}
});
it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {
const originalBasePath = process.env.NEXT_BASE_PATH;
try {
const mockNextConfig = {};
withPayload(mockNextConfig);
// Verify it didn't set the env var
expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath);
} finally {
// Restore original value
if (originalBasePath === undefined) {
delete process.env.NEXT_BASE_PATH;
} else {
process.env.NEXT_BASE_PATH = originalBasePath;
}
}
});
});
//# sourceMappingURL=withPayload.spec.js.map