Files
tilbudgivern/tests/test_check_offer.js
alexpolo1 26d3452d59 Add comprehensive tests for API verification, frontend integration, and PDF generation
- Implemented a new test suite for production API verification using curl, ensuring all critical endpoints respond correctly and return valid JSON.
- Added frontend integration tests to check for critical errors in the UI and verify key UI elements are present and functional.
- Created test data for quotes and project calculations to facilitate testing.
- Developed a script to check offers in the Ordrestyring system, including detailed task descriptions.
- Added tests for generating PDFs from quote data, ensuring the output is valid and contains expected information.
- Implemented a test script for the Røsevangen project, integrating with the Ordrestyring API and verifying database entries.
2025-11-07 08:02:07 +00:00

41 lines
1.3 KiB
JavaScript

// Test script to check offer in Ordrestyring
const OrdrestyringQuoteService = require('./backend/src/services/ordrestyringQuoteService');
const offerId = process.argv[2] || 6854;
async function checkOffer() {
const service = new OrdrestyringQuoteService();
try {
console.log(`\n🔍 Checking offer ${offerId}...`);
const offer = await service.getOfferWithTasks(offerId);
console.log('\n✅ Offer found:');
console.log(' ID:', offer.id);
console.log(' Number:', offer.number);
console.log(' Customer:', offer.customer.name);
console.log(' Status:', offer.status.text);
console.log(' Price ex VAT:', offer.totals.salesPrice, 'kr');
console.log(' Price incl VAT:', offer.totals.salesPriceWithVat, 'kr');
console.log('\n📋 Tasks:', offer.tasks.length);
offer.tasks.forEach((task, i) => {
console.log(`\n Task ${i+1}:`);
console.log(` ID: ${task.id}`);
console.log(` Header: ${task.header}`);
console.log(` Text length: ${task.text ? task.text.length : 0} characters`);
if (task.text && task.text.length > 0) {
console.log('\n--- FULL TEXT ---');
console.log(task.text);
console.log('--- END TEXT ---\n');
}
});
} catch (error) {
console.error('\n❌ Error:', error.message);
process.exit(1);
}
}
checkOffer();