| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- # Test script for Excel transformation pack
- Write-Host "Testing Excel Transformation Pack API..." -ForegroundColor Cyan
- # Test 1: Get pack data
- Write-Host ""
- Write-Host "1. Fetching pack data..." -ForegroundColor Yellow
- try {
- $packResponse = Invoke-RestMethod -Uri "http://127.0.0.1:8765/api/pack.php?pack=transformation-excel" -Method GET
- Write-Host " OK Pack ID: $($packResponse.pack_id)" -ForegroundColor Green
- Write-Host " OK Title: $($packResponse.pack_title)" -ForegroundColor Green
- Write-Host " OK Questions: $($packResponse.questions.Count)" -ForegroundColor Green
- Write-Host " OK Pillars: $($packResponse.pillars.Count)" -ForegroundColor Green
- }
- catch {
- Write-Host " ERROR Failed to fetch pack: $_" -ForegroundColor Red
- exit 1
- }
- # Test 2: Submit high-severity answers
- Write-Host ""
- Write-Host "2. Submitting high-severity answers..." -ForegroundColor Yellow
- $answersData = @{
- pack_id = "transformation-excel"
- answers = @{
- X1 = "x1_3"
- X2 = "x2_3"
- X3 = "x3_3"
- X4 = "x4_3"
- X5 = "x5_3"
- X6 = "x6_3"
- X7 = "x7_3"
- X8 = "x8_3"
- X9 = "x9_3"
- X10 = "x10_3"
- X11 = "x11_3"
- X12 = "x12_3"
- X13 = "x13_3"
- X14 = "x14_3"
- }
- optional = @{}
- }
- $jsonBody = $answersData | ConvertTo-Json -Depth 10
- try {
- $scoreResponse = Invoke-RestMethod -Uri "http://127.0.0.1:8765/api/score.php" -Method POST -Body $jsonBody -ContentType "application/json"
-
- Write-Host " OK Score: $($scoreResponse.score_total)/100" -ForegroundColor Green
- Write-Host " OK Level: $($scoreResponse.level) - $($scoreResponse.level_label)" -ForegroundColor Green
-
- Write-Host " OK Pillars:" -ForegroundColor Green
- foreach ($p in $scoreResponse.pillars) {
- Write-Host " - $($p.label): $($p.score)/$($p.max)" -ForegroundColor Gray
- }
-
- if ($scoreResponse.excel_diagnostic) {
- $xd = $scoreResponse.excel_diagnostic
- Write-Host " OK Excel Diagnostic:" -ForegroundColor Green
- Write-Host " - Douleur: $($xd.douleur)/100" -ForegroundColor Gray
- Write-Host " - Complexite: $($xd.complexite)/100" -ForegroundColor Gray
- Write-Host " - Verdict: $($xd.verdict.label)" -ForegroundColor Gray
- Write-Host " - Tag: $($xd.tag_label)" -ForegroundColor Gray
- }
- else {
- Write-Host " ERROR Excel diagnostic missing!" -ForegroundColor Red
- }
-
- Write-Host " OK Quick wins: $($scoreResponse.quick_wins_top5.Count)" -ForegroundColor Green
- Write-Host " OK Risks: $($scoreResponse.risks_top3.Count)" -ForegroundColor Green
- }
- catch {
- Write-Host " ERROR Failed to score: $_" -ForegroundColor Red
- exit 1
- }
- Write-Host ""
- Write-Host "SUCCESS All tests passed!" -ForegroundColor Green
|