Files
dwroller/test-rules.js
Alex dde3abda55 feat: Add validation and normalization utilities for player records
- Implemented `validatePlayer` and `normalizeTabInfo` functions in `database/validate.js` for player data validation and normalization.
- Added error handling for required fields and enforced data types and constraints.
- Introduced standardization for characteristics and skills.

feat: Create script for extracting rules from PDF files

- Developed `extract-rules.js` to extract text from PDF rulebooks and categorize rules.
- Integrated `pdftotext` for PDF processing and created a searchable rules database.
- Implemented rule categorization and indexing for efficient searching.

feat: Implement RulesTab component for rule searching

- Created `RulesTab.jsx` for searching and displaying rules with filtering options.
- Added recent searches and quick reference buttons for user convenience.
- Integrated API calls for fetching rules and displaying results dynamically.

feat: Add test script for Rules API

- Created `test-rules.js` to test the functionality of the Rules API endpoints.
- Included tests for search and stats endpoints to ensure proper response handling.
2025-08-16 12:15:32 +02:00

32 lines
941 B
JavaScript

const axios = require('axios');
async function testRulesAPI() {
try {
console.log('Testing Rules API...');
// Test search endpoint
const searchResponse = await axios.get('http://localhost:5000/api/rules/search?q=combat', {
headers: { 'x-gm-secret': 'bongo' }
});
console.log('Search results:', searchResponse.data);
console.log('Number of results:', searchResponse.data.results ? searchResponse.data.results.length : 0);
// Test stats endpoint
const statsResponse = await axios.get('http://localhost:5000/api/rules/stats', {
headers: { 'x-gm-secret': 'bongo' }
});
console.log('Stats:', statsResponse.data);
} catch (error) {
console.error('API Test failed:', error.message);
if (error.response) {
console.error('Response data:', error.response.data);
console.error('Response status:', error.response.status);
}
}
}
testRulesAPI();