![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/scripts/ |
#!/usr/bin/env node
/**
* Test script to verify registration links are correctly updated
* Run with: node scripts/test-registration-links.js
*/
const fs = require('fs');
const path = require('path');
const filesToCheck = [
'src/pages/index.tsx',
'src/pages/en/index.tsx',
'src/pages/register-verified.tsx',
'src/pages/en/register-verified.tsx',
'src/pages/lawyer/register-verified.tsx',
'src/pages/en/lawyer/register-verified.tsx'
];
const expectedLinks = {
'src/pages/index.tsx': [
'/register-verified',
'/register-verified',
'/register-verified',
'/register-verified'
],
'src/pages/en/index.tsx': [
'/en/register-verified',
'/en/register-verified',
'/en/register-verified',
'/en/register-verified'
]
};
function checkFile(filePath) {
console.log(`\nš Checking: ${filePath}`);
if (!fs.existsSync(filePath)) {
console.log(`ā File not found: ${filePath}`);
return false;
}
const content = fs.readFileSync(filePath, 'utf8');
const oldLinks = content.match(/\/lawyer\/register-verified/g) || [];
const newLinks = content.match(/\/register-verified/g) || [];
// Filter out meta tags and canonical URLs which are correct for legacy pages
const isLegacyPage = filePath.includes('/lawyer/');
const actualOldLinks = oldLinks.filter((_, index) => {
if (isLegacyPage) {
// For legacy pages, only count actual navigation links, not meta tags
const lines = content.split('\n');
const lineIndex = content.substring(0, content.indexOf(oldLinks[index])).split('\n').length - 1;
const line = lines[lineIndex];
return line.includes('href=') || line.includes('to=');
}
return true;
});
console.log(` Old links found: ${actualOldLinks.length}`);
console.log(` New links found: ${newLinks.length}`);
if (actualOldLinks.length > 0) {
console.log(` ā ļø Warning: Found ${actualOldLinks.length} old links that should be updated`);
return false;
}
if (newLinks.length === 0) {
console.log(` ā ļø Warning: No new registration links found`);
return false;
}
console.log(` ā
File looks good!`);
return true;
}
function main() {
console.log('š Testing Registration Links Update');
console.log('=====================================');
let allGood = true;
for (const file of filesToCheck) {
if (!checkFile(file)) {
allGood = false;
}
}
console.log('\nš Summary');
console.log('==========');
if (allGood) {
console.log('ā
All files are properly updated!');
console.log('\nš Registration system is ready:');
console.log(' ⢠/register-verified (French)');
console.log(' ⢠/en/register-verified (English)');
console.log(' ⢠/lawyer/register-verified (Legacy French)');
console.log(' ⢠/en/lawyer/register-verified (Legacy English)');
} else {
console.log('ā Some files need attention');
console.log('\nš§ Please check the files marked with warnings above');
}
console.log('\nš Next steps:');
console.log(' 1. Test the registration flow manually');
console.log(' 2. Verify language switching works');
console.log(' 3. Check that the Layout component is applied');
console.log(' 4. Test the CTA components on homepages');
}
if (require.main === module) {
main();
}
module.exports = { checkFile, main };