T.ME/BIBIL_0DAY
CasperSecurity


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/scripts/test-howto-schema-simple.js
const fs = require('fs');
const path = require('path');

function testHowToSchemaImplementation() {
  console.log('๐Ÿงช Testing HowTo Schema Implementation (Simple Validation)...\n');
  
  let allTestsPassed = true;
  
  // Test 1: Check if createHowToStructuredData function exists
  console.log('๐Ÿ“‹ Test 1: Checking createHowToStructuredData function...');
  try {
    const structuredDataPath = path.join(__dirname, '../src/components/StructuredData.tsx');
    const structuredDataContent = fs.readFileSync(structuredDataPath, 'utf8');
    
    if (structuredDataContent.includes('createHowToStructuredData')) {
      console.log('โœ… PASS: createHowToStructuredData function found');
    } else {
      console.log('โŒ FAIL: createHowToStructuredData function not found');
      allTestsPassed = false;
    }
  } catch (error) {
    console.log(`โŒ ERROR: Could not read StructuredData.tsx - ${error.message}`);
    allTestsPassed = false;
  }
  
  // Test 2: Check if HowTo interface is defined
  console.log('\n๐Ÿ“‹ Test 2: Checking HowTo interface definition...');
  try {
    const structuredDataPath = path.join(__dirname, '../src/components/StructuredData.tsx');
    const structuredDataContent = fs.readFileSync(structuredDataPath, 'utf8');
    
    if (structuredDataContent.includes('interface HowToStructuredData')) {
      console.log('โœ… PASS: HowToStructuredData interface found');
    } else {
      console.log('โŒ FAIL: HowToStructuredData interface not found');
      allTestsPassed = false;
    }
  } catch (error) {
    console.log(`โŒ ERROR: Could not read StructuredData.tsx - ${error.message}`);
    allTestsPassed = false;
  }
  
  // Test 3: Check class action page implementation
  console.log('\n๐Ÿ“‹ Test 3: Checking class action page implementation...');
  try {
    const classActionPath = path.join(__dirname, '../src/pages/class-action.tsx');
    const classActionContent = fs.readFileSync(classActionPath, 'utf8');
    
    const checks = [
      { name: 'OpenGraphMeta import', pattern: 'import OpenGraphMeta' },
      { name: 'StructuredData import', pattern: 'import StructuredData' },
      { name: 'createHowToStructuredData import', pattern: 'createHowToStructuredData' },
      { name: 'OpenGraphMeta component usage', pattern: '<OpenGraphMeta' },
      { name: 'StructuredData component usage', pattern: '<StructuredData' },
      { name: 'HowTo schema type', pattern: 'type="howTo"' },
      { name: 'HowTo steps array', pattern: 'steps: [' },
      { name: 'Class action specific content', pattern: 'Join the Class Action Against Quebec' }
    ];
    
    let pageChecksPassed = 0;
    checks.forEach(check => {
      if (classActionContent.includes(check.pattern)) {
        console.log(`โœ… PASS: ${check.name}`);
        pageChecksPassed++;
      } else {
        console.log(`โŒ FAIL: ${check.name}`);
      }
    });
    
    if (pageChecksPassed === checks.length) {
      console.log('โœ… PASS: All class action page checks passed');
    } else {
      console.log(`โŒ FAIL: ${checks.length - pageChecksPassed} class action page checks failed`);
      allTestsPassed = false;
    }
  } catch (error) {
    console.log(`โŒ ERROR: Could not read class-action.tsx - ${error.message}`);
    allTestsPassed = false;
  }
  
  // Test 4: Check new case page implementation
  console.log('\n๐Ÿ“‹ Test 4: Checking new case page implementation...');
  try {
    const newCasePath = path.join(__dirname, '../src/pages/hire/new-case.tsx');
    const newCaseContent = fs.readFileSync(newCasePath, 'utf8');
    
    const checks = [
      { name: 'OpenGraphMeta import', pattern: 'import OpenGraphMeta' },
      { name: 'StructuredData import', pattern: 'import StructuredData' },
      { name: 'createHowToStructuredData import', pattern: 'createHowToStructuredData' },
      { name: 'OpenGraphMeta component usage', pattern: '<OpenGraphMeta' },
      { name: 'StructuredData component usage', pattern: '<StructuredData' },
      { name: 'HowTo schema type', pattern: 'type="howTo"' },
      { name: 'HowTo steps array', pattern: 'steps: [' },
      { name: 'Case creation specific content', pattern: 'How to Create a New Legal Case' }
    ];
    
    let pageChecksPassed = 0;
    checks.forEach(check => {
      if (newCaseContent.includes(check.pattern)) {
        console.log(`โœ… PASS: ${check.name}`);
        pageChecksPassed++;
      } else {
        console.log(`โŒ FAIL: ${check.name}`);
      }
    });
    
    if (pageChecksPassed === checks.length) {
      console.log('โœ… PASS: All new case page checks passed');
    } else {
      console.log(`โŒ FAIL: ${checks.length - pageChecksPassed} new case page checks failed`);
      allTestsPassed = false;
    }
  } catch (error) {
    console.log(`โŒ ERROR: Could not read new-case.tsx - ${error.message}`);
    allTestsPassed = false;
  }
  
  // Test 5: Validate schema structure
  console.log('\n๐Ÿ“‹ Test 5: Validating schema structure...');
  try {
    const structuredDataPath = path.join(__dirname, '../src/components/StructuredData.tsx');
    const structuredDataContent = fs.readFileSync(structuredDataPath, 'utf8');
    
    const requiredFields = [
      '@context',
      '@type',
      'name',
      'description',
      'step'
    ];
    
    let structureChecksPassed = 0;
    requiredFields.forEach(field => {
      if (structuredDataContent.includes(field)) {
        console.log(`โœ… PASS: ${field} field found`);
        structureChecksPassed++;
      } else {
        console.log(`โŒ FAIL: ${field} field not found`);
      }
    });
    
    if (structureChecksPassed === requiredFields.length) {
      console.log('โœ… PASS: All required schema fields present');
    } else {
      console.log(`โŒ FAIL: ${requiredFields.length - structureChecksPassed} required fields missing`);
      allTestsPassed = false;
    }
  } catch (error) {
    console.log(`โŒ ERROR: Could not validate schema structure - ${error.message}`);
    allTestsPassed = false;
  }
  
  console.log('\n๐Ÿ“Š Test Summary:');
  console.log(allTestsPassed ? 'โœ… All tests passed!' : 'โŒ Some tests failed');
  
  if (allTestsPassed) {
    console.log('\n๐ŸŽ‰ HowTo Schema Implementation Complete!');
    console.log('\n๐Ÿ“‹ What was implemented:');
    console.log('   โ€ข createHowToStructuredData helper function');
    console.log('   โ€ข HowToStructuredData interface');
    console.log('   โ€ข Class Action page with HowTo schema (5 steps)');
    console.log('   โ€ข New Case Creation page with HowTo schema (9 steps)');
    console.log('   โ€ข Open Graph meta tags for both pages');
    console.log('\n๐Ÿ” Next steps:');
    console.log('   โ€ข Test pages with Google Rich Results Test');
    console.log('   โ€ข Verify schema appears in search results');
    console.log('   โ€ข Monitor for rich snippets in Google Search');
  }
  
  return allTestsPassed;
}

// Run the test if this file is executed directly
if (require.main === module) {
  testHowToSchemaImplementation();
}

module.exports = { testHowToSchemaImplementation }; 

CasperSecurity Mini