-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-simple-invoice.js
More file actions
45 lines (40 loc) · 1.12 KB
/
test-simple-invoice.js
File metadata and controls
45 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Simple test script to test the basic invoice saving functionality
// Run with: bun run test-simple-invoice.js
import { invoiceRepository } from './src/lib/repositories/InvoiceRepository.simple.ts'
async function testSimpleInvoiceSave() {
console.log('🧪 Testing simplified invoice save...')
const testRequest = {
agentId: 1,
vendorId: 1,
issueDate: '2024-01-15',
weekending: '2024-01-14',
sales: [
{
sale_date: '01-10-2024',
first_name: 'John',
last_name: 'Doe',
address: '123 Test St',
city: 'Test City',
status: 'active',
amount: 100.50
},
{
invoiceId: 1, // Test updating existing
sale_date: '01-11-2024',
first_name: 'Jane',
last_name: 'Smith',
address: '456 Test Ave',
city: 'Test Town',
status: 'active',
amount: 200.75
}
]
}
try {
const result = await invoiceRepository.saveInvoiceData(testRequest)
console.log('✅ Test successful:', result)
} catch (error) {
console.error('❌ Test failed:', error)
}
}
testSimpleInvoiceSave()