the-tip-top-backend/scripts/test-endpoint-filter.js
soufiane 33668e5a64 fix: resolve all ESLint warnings and update dependencies
- Remove unused variables and imports across codebase
- Use empty catch blocks where error object not needed
- Remove unused fs, path imports from apply-grand-prize-migration.js
- Remove unused OAuth2Client from oauth.controller.js
- Update dependencies to latest patch versions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 10:49:45 +01:00

41 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Script pour tester l'endpoint /api/admin/tickets avec filtrage
* Simule une vraie requête HTTP comme le ferait le frontend
*/
async function testEndpoint() {
try {
const baseURL = 'http://localhost:4000';
// Vous devrez remplacer TOKEN par un vrai token admin
const _token = 'VOTRE_TOKEN_ADMIN_ICI'; // eslint-disable-line no-unused-vars
console.log('\n🧪 TEST ENDPOINT /api/admin/tickets\n');
// Test 1: Sans filtre
console.log('1⃣ Test sans filtre:');
const url1 = `${baseURL}/api/admin/tickets?page=1&limit=5`;
console.log(` URL: ${url1}`);
// Test 2: Avec filtre prizeType
console.log('\n2⃣ Test avec filtre prizeType=THE_SIGNATURE:');
const url2 = `${baseURL}/api/admin/tickets?page=1&limit=5&prizeType=THE_SIGNATURE`;
console.log(` URL: ${url2}`);
console.log('\n📝 Pour tester manuellement:');
console.log(' 1. Copiez un de ces URLs');
console.log(' 2. Ouvrez Postman ou votre navigateur');
console.log(' 3. Ajoutez le header: Authorization: Bearer VOTRE_TOKEN');
console.log(' 4. Vérifiez les résultats\n');
console.log('💡 Alternative: Utilisez curl dans le terminal:');
console.log(`\n curl "${url2}" \\`);
console.log(' -H "Authorization: Bearer VOTRE_TOKEN"\n');
} catch (error) {
console.error('❌ Erreur:', error.message);
}
}
testEndpoint();