diff --git a/__tests__/manual/KYCManual.html b/__tests__/manual/KYCManual.html new file mode 100644 index 00000000..70b2bab2 --- /dev/null +++ b/__tests__/manual/KYCManual.html @@ -0,0 +1,211 @@ + + + + + KYC Test Results + + + +

KYC Test Results

+
+

Tester: P. Renulucshmi

+ +

Browser: Chrome

+

Device: desktop

+

Date: 2025-07-17

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NameCategoryPriorityPreconditionsStepsExpected ResultActual ResultStatus
1Upload valid NIC + selfieCREATIONHIGHUser logged in; KYC form visible + 1. Enter full name
2. Enter valid NIC
3. Upload NIC file + (<2MB)
4. Upload selfie-with-NIC
5. Click Submit +
+ New submission appears in Admin KYC list with status “Not Reviewed” + new submission appearsPASS
2Reject blank-field submissionVALIDATIONHIGHKYC page loaded1. Leave all fields empty
2. Click Submit
+ Inline errors under each field (“Full Name is required”, etc.); form + not submitted + please fill out this field appearedPASS
3Reject invalid NIC formatVALIDATIONMEDIUMKYC form visible1. Enter “abc123” in NIC Number
2. Click Submit
+ Validation message “Enter a valid NIC” under NIC field; no + submission + + Red inline error was there until we enter correct format "Enter + either Old NIC (9 digits + V/X) or New NIC (12 digits)" + PASS
4Reject oversize file uploadVALIDATIONMEDIUMKYC form visible1. Select >2MB file for NIC Document
2. Click Submit
Error toast “File must be under 2MB”; input resetsfile must be less than 2MB inline errorPASS
5View pending submissionsFILTERINGLOWAt least one KYC exists1. Navigate to KYC tab
2. Observe table
+ Table lists NIC, Recipient, Date Submitted, Status, Reviewed, + Documents, Accept/Reject + yes all the columns were presentPASS
6Download NIC & selfie filesFUNCTIONALITYMEDIUMKYC list visible1. Click download NIC icon
2. Click download Person icon
Each file downloads with correct name and contentfile downloaded after a clickPASS
7Accept a KYC submissionWORKFLOWHIGHOne “Not Reviewed” row present1. Click green ✔
2. Confirm if prompted
Status → “Accepted”; Reviewed date = todayaccepted as expectedPASS
8Reject a KYC submissionWORKFLOWHIGHOne “Not Reviewed” row present1. Click red ✖
2. Confirm if prompted
Status → “Rejected”; Reviewed date = todayRejected as expectedPASS
9Search by recipient nameFILTERINGLOWMultiple names present1. Type partial name in search boxTable filters to matching Recipient rows-PASS
10Sort by date submittedSORTINGLOWTable visible1. Click Date Submitted header
2. Click again
Rows toggle ascending/descending by Date Submittedyes it works as expectedPASS
11Filter by statusFILTERINGLOWVarious statuses exist1. Open status dropdown
2. Select “Accepted”
Table shows only rows with Status = Acceptedonly showed acccepted recordsPASS
+ + diff --git a/__tests__/manual/ReportingManual.html b/__tests__/manual/ReportingManual.html new file mode 100644 index 00000000..dba4d0b1 --- /dev/null +++ b/__tests__/manual/ReportingManual.html @@ -0,0 +1,170 @@ + + + + + Reporting Test Execution Results + + + + +
+

Reporting Page Test Results

+

Tester: P. Renulucshmi

+

Date: 2025-07-17

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NameCategoryPriorityPreconditionsTest StepsExpected ResultActual ResultStatus
RP01Reporting List RendersVIEWHIGHLogged in as Admin; ≥1 report exists + 1. Navigate to Reporting
+ 2. Wait for table to load +
Table displays all columns and rows correctlyAll reports appeared as expectedPASS
RP02Search ReportsFUNCTIONALITYMEDIUM≥3 reports with distinct data + 1. Enter “Not Following” in search
+ 2. Press Enter +
Only matching rows remain visibleSearch filtered correctlyPASS
RP03Filter by StatusFUNCTIONALITYMEDIUMReports in multiple statuses exist + 1. Open Status dropdown
+ 2. Select “Under Review” +
Only “Under Review” rows remainFilter worked as expectedPASS
RP04Download Report DataUTILITYLOWTable loaded + 1. Click the download (↓) icon on a row + Report data downloads successfullyDownload triggered with correct payloadPASS
RP05Email Reporting UserWORKFLOW–EMAILHIGHA pending report exists + 1. Click ✉️ next to Reporting User
+ 2. Send “Investigating…” email +
Status changes to “Under Review”Email sent; status updatedPASS
RP06Email Reported UserWORKFLOW–EMAILHIGHReport is “Under Review” + 1. Click ✉️ next to Reported User
+ 2. Send “Please provide details” email +
Email confirmation shownEmail sent successfullyPASS
RP07Issue Warning on False ReportWORKFLOW–ACTIONMEDIUMStatus “Under Review” + 1. Click ❌ (reject) icon
+ 2. Choose “Warn Reporter” +
Reporter warned; status = “Resolved – Reporter Warned”Warning email sent; status updatedPASS
RP08Issue Warning to Reported UserWORKFLOW–ACTIONMEDIUMStatus “Under Review” + 1. Click 🛡️ (warn) icon
+ 2. Confirm +
Reported user warned; status = “Resolved – Reported Warned”Warning email sent; status updatedPASS
RP09Resolve ReportWORKFLOW–COMPLETEHIGHAny non-resolved status + 1. Click ✔️ (resolve) icon
+ 2. Confirm +
Status changes to “Resolved”Report marked ResolvedPASS
+ + diff --git a/__tests__/manual/adminDashboardManual.html b/__tests__/manual/adminDashboardManual.html new file mode 100644 index 00000000..562000b8 --- /dev/null +++ b/__tests__/manual/adminDashboardManual.html @@ -0,0 +1,146 @@ + + + + + Admin Dashboard Results + + + + +

Admin Dashboard Test Results

+

Tester: P. Renulucshmi

+

Date: 2025-07-17

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NameCategoryPriorityPreconditionsTest StepsExpected ResultActual ResultStatus
1Dashboard Cards LoadVIEWHIGHLogged in as Admin/SuperAdmin1. Navigate to /admin/dashboard
2. Wait for page load
All five metric cards appear with correct valuesits loading as expectedPASS
2Cards AccuracyVERIFICATIONHIGHDashboard loaded; known backend data1. Compare card values to API/DB
2. Refresh page
Each card value matches the source of truthit matches with database count as wellPASS
3Registration Chart PlotVISUALIZATIONMEDIUM≥1 registration record exists1. Observe line chart
2. Hover data points
Chart shows daily points; tooltip shows date & count + when hover points in shows no of users registered on a specific day + PASS
4Chart Date Range FilterFUNCTIONALITYMEDIUMDate‑range dropdown visible1. Select Last 7 Days
2. Select All Time
Chart re‑renders to selected rangechart re renders when we change the drop downPASS
5Skill Distribution DonutVISUALIZATIONMEDIUM≥1 skill assignment exists1. Observe donut chart
2. Hover slices
Each slice shows category & %; total sums to 100%each hover shows no of skills in each cateogoryPASS
6Loading SkeletonsUXLOWNetwork throttled1. Throttle to Slow 3G
2. Reload page
Skeleton placeholders displayed until data arrivesuntil data arrives it shows loading signPASS
7Network Calls VerificationDEBUGLOWDevTools open1. Monitor Network tab
2. Reload page
GET /api/dashboard fires once; no 404/500 errors + A single GET /api/dashboard request fired on load (200 OK), followed + by two GET /api/skillLists requests; no 404/500 errors. + PASS
+ + diff --git a/__tests__/manual/adminLoginManual.html b/__tests__/manual/adminLoginManual.html new file mode 100644 index 00000000..f6be63e8 --- /dev/null +++ b/__tests__/manual/adminLoginManual.html @@ -0,0 +1,108 @@ + + + + + Admin Login Test Results + + + + +

Admin Login Test Results

+

Tester: P. Renulucshmi

+

Date: 2025-07-17

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NamePriorityPreconditionsStepsExpectedActualStatus
1Page Load & UI ElementsHIGHBrowser open; Admin login page reachableNavigate to /admin/login
Observe form fields and buttons
Username, Password fields and Login button are visibleyes can view the pagePASS
2Empty Fields ValidationMEDIUMLogin page openLeave both fields blank
Click Login
Inline errors: “Username required” and “Password required”yes validatedPASS
3Invalid CredentialsHIGHLogin page openEnter wrong username/password
Click Login
Error toast: “Invalid credentials”Invalid username or password inline errorPASS
4Successful LoginHIGHValid admin credentialsFill in correct username & password
Click Login
Redirect to /admin/dashboardit redirect to dashboardPASS
5Password Mask ToggleLOWLogin form visibleEnter password
Click show/hide icon
Password toggles between masked and plain textwhen click the toggle password is visiblePASS
+ + diff --git a/__tests__/manual/adminManagementManual.html b/__tests__/manual/adminManagementManual.html new file mode 100644 index 00000000..5fe5cb73 --- /dev/null +++ b/__tests__/manual/adminManagementManual.html @@ -0,0 +1,201 @@ + + + + + Admin Management Results + + + +

Admin Management Test Results

+
+

Tester: P. Renulucshmi

+

Browser: Chrome

+

Device: desktop

+

Date: 2025-07-17

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NameCategoryPriorityPreconditionsTest StepsExpected ResultActual ResultStatus
1View Admin ListVIEWINGMEDIUMLogged in as Admin or Super Admin; Admin Management page open + 1. Navigate to Admin Management
2. Wait for table to load +
+ Table shows Username, Email, Role, Permissions, Created, Actions; ≥1 + row present + table with the all columns showedPASS
2Search by Username or EmailFILTERINGLOWAdmin Mgmt page loaded with ≥2 entries1. Type part of a username or email into search boxOnly matching rows remain visibleyes search box is functioning as expectedPASS
3Filter by RoleFILTERINGLOWMixed Admin & Super Admin rows present1. Select Admin then Super Admin from dropdownTable filters to show only rows for the selected rolefilter show only respected columnPASS
4Edit Admin DetailsUPDATEMEDIUMAt least one row present; Edit icon visible + 1. Click ✏️ on a row
2. Change email or role
3. Click Save +
That row updates to reflect the new email/rolethe row update after editPASS
5Delete Another AdminDELETIONHIGHAnother user’s row exists1. Click 🗑️ on that row
2. Confirm deletion
Row is removed; success message shownsuccessfully deletedPASS
6Prevent Self‑DeletionVALIDATIONHIGHYour own row present1. Attempt to click 🗑️ on your own rowDelete button disabled or error “Cannot delete yourself.”its not allowing to deleted myselfPASS
7Create New Admin (Super only)CREATIONHIGHLogged in as Super Admin; Create Admin button visible + 1. Click Create Admin
2. Fill Username, Email, Password, + Role=Admin, Permissions
3. Click Create Admin +
New admin appears in the table with correct detailsyes superadmin can create new adminPASS
8Deny Access to Admin Mgmt (Admin only)VALIDATIONHIGHLogged in as normal Admin1. Look for Admin Management tab/menu itemNo Admin Management entry is visible to normal Admin + admin admin management tab is not visible. only visible for + superAdmin + PASS
9Validate Create‑FormVALIDATIONMEDIUMCreate Admin modal open + 1. Leave required fields blank or invalid
2. Click Create Admin +
Inline validation errors appear; form not submittedusername ,password ,email validation are includedPASS
10Permission PersistenceFUNCTIONALITYMEDIUMAfter Create or Edit1. Reload Admin Management pageCreated/edited admins & permissions persist correctlyafter reload also its persistedPASS
+ + diff --git a/__tests__/manual/badgeManagerManual.html b/__tests__/manual/badgeManagerManual.html new file mode 100644 index 00000000..02030f71 --- /dev/null +++ b/__tests__/manual/badgeManagerManual.html @@ -0,0 +1,189 @@ + + + + + BadgeManager Results + + + +

BadgeManager Test Results

+
+

Tester: P. Renulucshmi

+ +

Browser: Chrome

+

Device: desktop

+

Date: 2025-07-17

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NameCategoryPriorityPreconditionsTest StepsExpected ResultActual ResultStatus
1Badge Name RequiredADDHIGH“Add New Badge” form visible; all fields empty + 1. Leave Badge Name blank
2. Fill other fields correctly
3. + Click Add Badge +
Inline error “Badge Name is required”; form not submittedBadge name is required inline errorPASS
2Badge Name Min‑Length (≥3 chars)ADDMEDIUM“Add New Badge” form visible + 1. Enter 1–2 chars in Badge Name
2. Fill others correctly
3. + Click Add Badge +
+ Inline error “Name must be at least 3 characters”; submit disabled + inline error Badge name must be at least 3 characters long.PASS
3Description Required & Min‑LengthADDHIGH“Add New Badge” form visible + 1. Leave Description blank or <10 chars
2. Fill other fields + correctly
3. Click Add Badge +
+ Inline error “Description must be at least 10 characters”; form not + submitted + inline error showedPASS
4Image Required & FormatADDHIGH“Add New Badge” form visible1. Leave Badge Image empty
2. Click Add Badge
+ Inline error “Please upload an image” or “Unsupported file format” + + Invalid image type. Please use JPEG, PNG, GIF or WEBP inline error + PASS
5Image Size Limit (≤2 MB)ADDMEDIUM“Add New Badge” form visible1. Upload file >2 MB
2. Click Add Badge
Inline error “Image must be smaller than 2 MB”Image size should be less than 2MB inline errorPASS
6Edit Badge Inline ValidationUPDATEHIGHAt least one badge card present + 1. Click Edit on a badge
2. Clear or shorten Badge + Name/Description +
Same inline errors as BM01–BM03; Save blocked until validinline error showedPASS
7Submit Edit Updates ListUPDATEMEDIUMEdit form open; fields valid1. Modify name or image
2. Click Save
Badge card updates immediately without full reloadits updated without reloading pagePASS
8Delete Badge ConfirmationDELETEMEDIUMAt least one badge card present1. Click Delete on a badge
2. Confirm deletion
+ Confirmation dialog appears; after confirm, badge removed and + success alert shown + Badge deleted successfully! alert shownPASS
+ + diff --git a/__tests__/manual/badgeManual.html b/__tests__/manual/badgeManual.html new file mode 100644 index 00000000..92485fa4 --- /dev/null +++ b/__tests__/manual/badgeManual.html @@ -0,0 +1,117 @@ + + + + + Badges Test Results + + + + +

Badges Test Results

+
+

Tester: P.Renulucshmi

+

Date: 17/07/2025

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NamePriorityPreconditionsTest StepsExpected ResultActual ResultStatus
1Page Load & Default List (BG01)HighUser authenticated; at least 1 badge exists + 1. Navigate to /badges
+ 2. Wait for page load to complete +
All badges rendered as cards; Category dropdown set to “All”yes worked as expectedPass
2Filter by Category (BG02)MediumMultiple badges across categories exist + 1. Select “Achievement Milestone” in Category dropdown
+ 2. Observe the displayed badge list +
Only “Achievement Milestone” badges remain visiblework as expectedPass
+ + diff --git a/__tests__/manual/suspendedUserManual.html b/__tests__/manual/suspendedUserManual.html new file mode 100644 index 00000000..ce16bcd8 --- /dev/null +++ b/__tests__/manual/suspendedUserManual.html @@ -0,0 +1,129 @@ + + + + + Suspended Users Test Results + + + +

Suspended Users Test Results

+

Tester: P.Renlucshmi

+

Date: 2025-07-17

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Test NamePriorityPreconditionsStepsExpected ResultExec DateActual ResultStatus
SU01Suspend a UserHighUser exists; Admin logged in + 1. Go to Users
+ 2. Click “Suspend”
+ 3. Enter reason
+ 4. Confirm +
User moves to Suspended list2025‑07‑17User moved from Users to Suspended UsersPass
SU02Search Suspended UsersMedium≥1 suspended user + 1. Open Suspended Users
+ 2. Type search +
Table filters to matching rows2025‑07‑17Search worksPass
SU03Prevent Suspended LoginHighUser is suspended1. Attempt loginLogin blocked with suspend message2025‑07‑17User blocked from loginPass
SU04Prevent Re‑registrationMediumEmail suspended1. Sign up with same emailRegistration rejected: Email in use2025‑07‑17Cannot create account with same emailPass
SU05Unsuspend a UserHighUser in Suspended list + 1. Click ✓
+ 2. Confirm +
User moves back to Users list2025‑07‑17User unsuspended and can log in againPass
SU06Reason ValidationMediumSuspend dialog open1. Click Confirm without reasonError: Reason is required2025‑07‑17User isn’t suspended without a reasonPass
+ + diff --git a/test-unsuspension-fix.mjs b/test-unsuspension-fix.mjs deleted file mode 100644 index 085b963f..00000000 --- a/test-unsuspension-fix.mjs +++ /dev/null @@ -1,107 +0,0 @@ -import { MongoClient } from "mongodb"; -import dotenv from "dotenv"; -import bcrypt from "bcryptjs"; - -// Load environment variables -dotenv.config(); - -// Test script to simulate unsuspension with proper password handling -async function testUnsuspensionFix() { - const uri = - process.env.MONGODB_URI || "mongodb://localhost:27017/skillswaphub"; - const client = new MongoClient(uri); - - try { - await client.connect(); - const db = client.db(); - - console.log("🔍 Testing unsuspension fix..."); - - // First, let's create a test suspended user with a proper password - const testPassword = "testPassword123"; - const hashedPassword = await bcrypt.hash(testPassword, 10); - - const testSuspendedUser = { - firstName: "Test", - lastName: "User2", - email: "testuser2@test.com", - phone: "1234567890", - title: "Test Title", - password: hashedPassword, - avatar: null, - googleId: null, - isGoogleUser: false, - profileCompleted: true, - originalCreatedAt: new Date(), - originalUpdatedAt: new Date(), - suspendedAt: new Date(), - suspendedBy: "admin", - suspensionReason: "Testing", - suspensionNotes: "Test suspension", - originalUserId: "test-user-id", - }; - - // Insert the suspended user - await db.collection("suspended_users").insertOne(testSuspendedUser); - console.log("✅ Created test suspended user"); - - // Now simulate the unsuspension process - const restoredUserData = { - firstName: testSuspendedUser.firstName, - lastName: testSuspendedUser.lastName, - email: testSuspendedUser.email, - phone: testSuspendedUser.phone, - title: testSuspendedUser.title, - password: testSuspendedUser.password, - avatar: testSuspendedUser.avatar, - googleId: testSuspendedUser.googleId, - isGoogleUser: testSuspendedUser.isGoogleUser, - profileCompleted: testSuspendedUser.profileCompleted, - createdAt: testSuspendedUser.originalCreatedAt, - updatedAt: new Date(), - }; - - // Insert directly into users collection (simulating the fixed API) - await db.collection("users").insertOne(restoredUserData); - console.log("✅ Restored user to main collection"); - - // Test the password - const restoredUser = await db - .collection("users") - .findOne({ email: testSuspendedUser.email }); - if (restoredUser) { - console.log( - `🔑 Restored password length: ${restoredUser.password.length}` - ); - console.log( - `🔐 Password starts with $2: ${restoredUser.password.startsWith("$2")}` - ); - - // Test password comparison - const isValid = await bcrypt.compare(testPassword, restoredUser.password); - console.log(`✅ Password validation: ${isValid}`); - - if (isValid) { - console.log("🎉 SUCCESS: Password was preserved correctly!"); - } else { - console.log("❌ FAILED: Password was corrupted during restoration"); - } - } - - // Clean up - await db - .collection("suspended_users") - .deleteOne({ email: testSuspendedUser.email }); - await db.collection("users").deleteOne({ email: testSuspendedUser.email }); - console.log("🧹 Cleaned up test data"); - - console.log("\n✅ Test completed"); - } catch (error) { - console.error("❌ Error testing unsuspension fix:", error); - } finally { - await client.close(); - } -} - -// Run the test -testUnsuspensionFix().catch(console.error); diff --git a/test-unsuspension.mjs b/test-unsuspension.mjs deleted file mode 100644 index a78af666..00000000 --- a/test-unsuspension.mjs +++ /dev/null @@ -1,77 +0,0 @@ -import { MongoClient } from "mongodb"; -import dotenv from "dotenv"; - -// Load environment variables -dotenv.config(); - -// Test script to verify unsuspension process -async function testUnsuspensionProcess() { - const uri = - process.env.MONGODB_URI || "mongodb://localhost:27017/skillswaphub"; - const client = new MongoClient(uri); - - try { - await client.connect(); - const db = client.db(); - - console.log("🔍 Testing unsuspension process..."); - - // Check if we have any suspended users - const suspendedUsers = await db - .collection("suspended_users") - .find({}) - .toArray(); - console.log(`📊 Found ${suspendedUsers.length} suspended users`); - - if (suspendedUsers.length > 0) { - const testUser = suspendedUsers[0]; - console.log( - `👤 Test user: ${testUser.firstName} ${testUser.lastName} (${testUser.email})` - ); - console.log(`🔑 Has password: ${!!testUser.password}`); - console.log(`📅 Originally created: ${testUser.originalCreatedAt}`); - console.log(`🚫 Suspended: ${testUser.suspendedAt}`); - console.log(`📝 Reason: ${testUser.suspensionReason}`); - - // Verify the user is not in the main users collection - const existingUser = await db - .collection("users") - .findOne({ email: testUser.email }); - console.log(`✅ User exists in main collection: ${!!existingUser}`); - - if (!existingUser) { - console.log( - "✅ Suspension process is working correctly - user is not in main collection" - ); - } else { - console.log("❌ Issue: User exists in both collections"); - } - } else { - console.log("ℹ️ No suspended users found to test"); - } - - // Check for any recently unsuspended users - const recentUsers = await db - .collection("users") - .find({}) - .sort({ updatedAt: -1 }) - .limit(5) - .toArray(); - - console.log(`\n🔍 Recent users in main collection: ${recentUsers.length}`); - recentUsers.forEach((user, i) => { - console.log( - `${i + 1}. ${user.firstName} ${user.lastName} (${user.email}) - Updated: ${user.updatedAt}` - ); - }); - - console.log("\n✅ Test completed"); - } catch (error) { - console.error("❌ Error testing unsuspension process:", error); - } finally { - await client.close(); - } -} - -// Run the test -testUnsuspensionProcess().catch(console.error); diff --git a/test-user-population.js b/test-user-population.js deleted file mode 100644 index 56b1e4e5..00000000 --- a/test-user-population.js +++ /dev/null @@ -1,88 +0,0 @@ -// Test script to verify user population in reports -const testUserPopulation = async () => { - try { - console.log("Testing user population in admin reports..."); - - // Test the API endpoint - const response = await fetch("http://localhost:3000/api/admin/reports"); - const reports = await response.json(); - - console.log(`Found ${reports.length} reports`); - - if (reports.length > 0) { - const firstReport = reports[0]; - - console.log("=== First Report Analysis ==="); - console.log("Report ID:", firstReport._id); - - // Check reportedBy user population - console.log("\n--- Reported By User ---"); - if (firstReport.reportedBy) { - console.log("✅ reportedBy is populated"); - console.log(" - ID:", firstReport.reportedBy._id); - console.log( - " - Name:", - `${firstReport.reportedBy.firstName} ${firstReport.reportedBy.lastName}` - ); - console.log(" - Email:", firstReport.reportedBy.email); - } else { - console.log("❌ reportedBy is NOT populated"); - } - - // Check reportedUser population - console.log("\n--- Reported User ---"); - if (firstReport.reportedUser) { - console.log("✅ reportedUser is populated"); - console.log(" - ID:", firstReport.reportedUser._id); - console.log( - " - Name:", - `${firstReport.reportedUser.firstName} ${firstReport.reportedUser.lastName}` - ); - console.log(" - Email:", firstReport.reportedUser.email); - } else { - console.log("❌ reportedUser is NOT populated"); - } - - // Check session population - console.log("\n--- Session Data ---"); - if (firstReport.sessionId) { - console.log("✅ sessionId is populated"); - console.log(" - ID:", firstReport.sessionId._id); - console.log( - " - Service 1:", - firstReport.sessionId.descriptionOfService1 - ); - console.log( - " - Service 2:", - firstReport.sessionId.descriptionOfService2 - ); - } else { - console.log("❌ sessionId is NOT populated"); - } - - // Summary - console.log("\n=== SUMMARY ==="); - console.log( - "User Schema Integration:", - firstReport.reportedBy && firstReport.reportedUser - ? "✅ SUCCESS" - : "❌ FAILED" - ); - } else { - console.log("No reports found. Try creating a test report first."); - } - } catch (error) { - console.error("Error testing user population:", error); - } -}; - -// If running in browser console -if (typeof window !== "undefined") { - window.testUserPopulation = testUserPopulation; - console.log("Run 'testUserPopulation()' in the browser console to test"); -} - -// If running in Node.js -if (typeof module !== "undefined") { - module.exports = testUserPopulation; -} diff --git a/test-user-suspension-system.js b/test-user-suspension-system.js deleted file mode 100644 index e69de29b..00000000