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.ca/public_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/public_html/scripts/test-chat-api.js
const fetch = require('node-fetch');

async function testChatAPI() {
  console.log('๐Ÿงช Testing Chat API Endpoints...\n');

  const baseUrl = 'http://localhost:3000';

  try {
    // Test 1: Chat rooms endpoint (should return 401 without auth)
    console.log('1. Testing GET /api/chat/rooms (should return 401 without auth)...');
    const roomsResponse = await fetch(`${baseUrl}/api/chat/rooms`);
    console.log(`Status: ${roomsResponse.status}`);
    if (roomsResponse.status === 401) {
      console.log('โœ… Correctly returns 401 Unauthorized without authentication');
    } else {
      console.log('โŒ Unexpected response:', roomsResponse.status);
    }

    // Test 2: Group messages endpoint (should return 401 without auth)
    console.log('\n2. Testing GET /api/chat/group/messages (should return 401 without auth)...');
    const messagesResponse = await fetch(`${baseUrl}/api/chat/group/messages?chatRoomId=test`);
    console.log(`Status: ${messagesResponse.status}`);
    if (messagesResponse.status === 401) {
      console.log('โœ… Correctly returns 401 Unauthorized without authentication');
    } else {
      console.log('โŒ Unexpected response:', messagesResponse.status);
    }

    // Test 3: Check if server is running
    console.log('\n3. Testing server availability...');
    const healthResponse = await fetch(`${baseUrl}/`);
    console.log(`Status: ${healthResponse.status}`);
    if (healthResponse.status === 200) {
      console.log('โœ… Server is running and responding');
    } else {
      console.log('โŒ Server not responding properly');
    }

    console.log('\n๐ŸŽ‰ Chat API tests completed!');
    console.log('\n๐Ÿ“‹ To test with authentication:');
    console.log('   1. Open browser: http://localhost:3000');
    console.log('   2. Login with: admin@example.com / password123');
    console.log('   3. Navigate to: /group-chat');
    console.log('   4. Test sending messages and creating rooms');

  } catch (error) {
    console.error('โŒ Error testing chat API:', error.message);
    console.log('\n๐Ÿ’ก Make sure the server is running with: npm run dev');
  }
}

testChatAPI(); 

CasperSecurity Mini