Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
5ba4f9e
add new methods
shuangela Oct 24, 2025
1731299
remove comment line
shuangela Oct 24, 2025
303fecc
add comment for vector search
shuangela Oct 24, 2025
e6942b2
feedback
shuangela Oct 27, 2025
aa1db24
pr feedback
shuangela Oct 27, 2025
0362be7
remove unneeded imports
shuangela Oct 27, 2025
1cc125a
add agg stage comments
shuangela Oct 28, 2025
49b967a
fix broken code
shuangela Oct 28, 2025
f884b21
Merge pull request #5 from mongodb/crud-aggregations-python
shuangela Oct 28, 2025
9536cde
feat: set up repo structure and backend connection
cbullinger Oct 24, 2025
f55b1d6
feat: add model layer
cbullinger Oct 24, 2025
7e25be6
feat: add CRUD endpoints
cbullinger Oct 24, 2025
dd8fe3a
fix: remove unneeded files and update .gitignore and .gitattributes
cbullinger Oct 24, 2025
7ea6b1e
fix: resolve module access issue with driver v5.6
cbullinger Oct 24, 2025
462d71f
refactor(RuntimeException): Add new DatabaseOperationException.java c…
cbullinger Oct 28, 2025
170c3c5
refactor(pojo): apply patch and use POJO codec
cbullinger Oct 28, 2025
2ea3ff0
refactor(serializer): Apply patch and use ObjectMapper
cbullinger Oct 28, 2025
f454cc8
refactor(field names): implement nested fields consistently
cbullinger Oct 28, 2025
c6eeb46
test: add new tests based on refactors
cbullinger Oct 28, 2025
2d5087b
refactor(DTOs): create missing return types
cbullinger Oct 28, 2025
7b9029c
refactor(spring data): implement spring data fully
cbullinger Oct 28, 2025
360d825
update TODOs
cbullinger Oct 28, 2025
489c950
rename app
cbullinger Oct 28, 2025
5b6f266
remove unnecessary file
cbullinger Oct 28, 2025
605d839
update README
cbullinger Oct 28, 2025
c23c709
Apply Vitaliy feedback
cbullinger Oct 29, 2025
0f3dc54
Apply suggestion from @cbullinger
cbullinger Oct 29, 2025
9253973
Apply suggestion from @cbullinger
cbullinger Oct 29, 2025
cc13e06
docs: update comments throughout for consistency
cbullinger Oct 29, 2025
6155906
docs: update readme and remove internal todo doc
cbullinger Oct 30, 2025
b10f743
fix(movies): add back missing @Document tag
cbullinger Oct 30, 2025
5d1b7d9
Feat finishing python crud - merging python backends together (#10)
tmcneil-mdb Oct 30, 2025
8145711
Merge pull request #6 from mongodb/java-scaffolding-setup
cbullinger Oct 30, 2025
d79ce30
feat(java): add aggregation endpoints
cbullinger Oct 30, 2025
caf7755
add new info
shuangela Oct 30, 2025
efd31b8
test vs
shuangela Oct 30, 2025
4976059
add new comments
shuangela Oct 30, 2025
748af9f
add error handling
shuangela Oct 30, 2025
238d734
tests(java): add tests for atlas search
cbullinger Oct 31, 2025
d6672d3
update search to cover all query parameters
cbullinger Oct 31, 2025
d02258e
small fixes
cbullinger Oct 31, 2025
246e795
docs(java): update details for swagger docs
cbullinger Oct 31, 2025
0992799
feat: implement movie details page and optimize components (#9)
jordan-smith721 Nov 3, 2025
180959f
Apply Jordan feedback
cbullinger Nov 3, 2025
3879ae3
fix: use validated limit from the request parameter for the comments …
cbullinger Nov 3, 2025
2fa5ea0
Merge pull request #12 from mongodb/docsp-54966-aggregation
cbullinger Nov 3, 2025
14340a1
feat(java): add vector search
cbullinger Nov 3, 2025
f820a05
Add unit tests
cbullinger Nov 4, 2025
ad95b2b
update the vector search index creation
cbullinger Nov 4, 2025
cfd0e8d
update comments in verification
cbullinger Nov 4, 2025
2d79bde
feedback changes
shuangela Nov 4, 2025
9f99a28
Add READMEs to development
dacharyc Nov 4, 2025
373d544
Merge pull request #16 from dacharyc/add-readmes
dacharyc Nov 4, 2025
ab34e0f
Merge branch 'development' of ssh://github.com/mongodb/docs-sample-ap…
cbullinger Nov 4, 2025
b755575
fix: add id annotation to movie
cbullinger Nov 4, 2025
252d59b
reorder order of endpoints in function
shuangela Nov 4, 2025
eceb07d
Merge pull request #13 from mongodb/python-vector-search-backend
shuangela Nov 4, 2025
4516e99
refactor: use driver instead of http request
cbullinger Nov 5, 2025
259aaae
feat: implement Mongodb search front end (#15)
jordan-smith721 Nov 5, 2025
f881557
Apply suggestions from code review
cbullinger Nov 5, 2025
bffca50
Merge pull request #14 from mongodb/docsp-54427-vector
cbullinger Nov 5, 2025
c83ea42
fix(java): get batch and search working properly with frontend
cbullinger Nov 5, 2025
7567f42
docs: clean up TODOs in README
cbullinger Nov 5, 2025
eff6b99
Update server/java-spring/src/main/java/com/mongodb/samplemflix/confi…
cbullinger Nov 5, 2025
452b5fd
Update server/java-spring/src/main/java/com/mongodb/samplemflix/contr…
cbullinger Nov 5, 2025
a9d8c6c
Merge pull request #19 from mongodb/java-backend-fixes
cbullinger Nov 5, 2025
7ec583f
fix(python): add missing import
cbullinger Nov 5, 2025
c55950b
Merge pull request #20 from mongodb/hotfix-py
cbullinger Nov 5, 2025
b28fd74
Add CI workflows for Java and Express
dacharyc Nov 5, 2025
0ddb4a1
fix(java): index creation logic
cbullinger Nov 5, 2025
54eab01
docs(java): update README
cbullinger Nov 5, 2025
e4504f6
Merge pull request #22 from mongodb/java-clean-up
cbullinger Nov 5, 2025
a29569f
clean up sample app
shuangela Nov 5, 2025
bc6a612
add explanatory comment
shuangela Nov 5, 2025
1f6fd32
Update GitHub workflows to use local scripts for test summary display
dacharyc Nov 5, 2025
7ab8455
Fix script path issue by overriding working directory in test summary…
dacharyc Nov 5, 2025
b38963e
Pass MONGODB_URI directly to maven when invoking it
dacharyc Nov 5, 2025
21e89a0
Handle env variables in pom.xml for Surefire Plugin
dacharyc Nov 5, 2025
0d1e0b4
Try 'argLine' I guess?
dacharyc Nov 5, 2025
851526b
Maybe this? Maybe?
dacharyc Nov 5, 2025
113a1b9
Try what works in the docs repo?
dacharyc Nov 5, 2025
1974e1e
Try, try again
dacharyc Nov 5, 2025
c612218
Zillionth time is the charm?
dacharyc Nov 5, 2025
1b4af15
Add debug output to workflow
dacharyc Nov 5, 2025
54ccf5f
Try using GitHub environment
dacharyc Nov 5, 2025
19ea29b
Merge pull request #21 from dacharyc/add-ci-workflows
dacharyc Nov 5, 2025
5d26e64
test(python): add test infrastructure
cbullinger Nov 6, 2025
55b7c65
feat: add a dashboard page to the front end to display aggregations (…
jordan-smith721 Nov 6, 2025
2755c63
feat: add searches and aggregation to express backend
jordan-smith721 Nov 6, 2025
8276d84
feat: implement vector search UI (#23)
jordan-smith721 Nov 6, 2025
3ee207f
Merge remote-tracking branch 'upstream/development' into express-updates
jordan-smith721 Nov 6, 2025
d21db80
Merge pull request #27 from mongodb/python-unit-tests
dacharyc Nov 6, 2025
dbb1dbf
fix vector search implementation
jordan-smith721 Nov 6, 2025
2b71ff3
add new changes
shuangela Nov 6, 2025
07ca7f2
Merge branch 'development' into python-backend-cleanup
shuangela Nov 6, 2025
158cdbb
Merge pull request #26 from mongodb/python-backend-cleanup
shuangela Nov 6, 2025
3c2042f
Rename test file and add unit tests for routes
dacharyc Nov 6, 2025
65bf062
Add tests for remaining routes, missing import
dacharyc Nov 6, 2025
093d78a
Add integration tests, update workflow and script
dacharyc Nov 6, 2025
050539d
Update tests after pulling in bug fix
dacharyc Nov 6, 2025
833321f
Add integration tests for remaining aggregation APIs
dacharyc Nov 7, 2025
7e40f17
Merge pull request #29 from dacharyc/add-python-integration-tests
dacharyc Nov 7, 2025
e6ec7c6
Move Java Spring and Python FastAPI apps to final dir structure
dacharyc Nov 7, 2025
24b407a
Dachary feedback
jordan-smith721 Nov 7, 2025
0a238d6
Merge pull request #30 from dacharyc/move-feature-complete-apps
dacharyc Nov 7, 2025
d7c83d3
Merge pull request #28 from jordan-smith721/express-updates
dacharyc Nov 7, 2025
de6d889
Express: Add Swagger API docs
dacharyc Nov 5, 2025
5610a75
Add Swagger annotations for new routes
dacharyc Nov 7, 2025
aeca8fc
Fix controller comments to match routes whose names have changed
dacharyc Nov 7, 2025
dff7906
Merge pull request #25 from dacharyc/express-add-docs
dacharyc Nov 7, 2025
d3c66e6
Add integration tests for Express server
dacharyc Nov 5, 2025
e80e73b
Add integration tests for new API endpoints, update testing pattern
dacharyc Nov 7, 2025
78206d3
Update CI workflow to also run integration tests
dacharyc Nov 7, 2025
faabe6a
Merge pull request #24 from dacharyc/express-integration-tests
dacharyc Nov 7, 2025
a1e276f
Restructure files into mflix directory (#32)
jordan-smith721 Nov 7, 2025
5cda8e2
cleanup and READMEs
jordan-smith721 Nov 7, 2025
b9cecb8
sync env examples and add voyage dependency to readmes
jordan-smith721 Nov 7, 2025
605e3af
update readme
shuangela Nov 7, 2025
be79f27
Dachary feedback
jordan-smith721 Nov 7, 2025
30de09e
Dachary feedback
jordan-smith721 Nov 7, 2025
7904869
dachary feedback
shuangela Nov 7, 2025
b312aaf
Merge pull request #34 from mongodb/python-readme
shuangela Nov 7, 2025
251250b
Merge branch 'development' into cleanup2
dacharyc Nov 7, 2025
2f9ea16
Merge pull request #33 from jordan-smith721/cleanup2
dacharyc Nov 7, 2025
d3e3326
Remove unneeded files from client
dacharyc Nov 7, 2025
cb2cf03
Run FastAPI server on port 3001
dacharyc Nov 7, 2025
d002f2c
Remove unneeded comments
dacharyc Nov 7, 2025
92472c3
Clean up tests dir
dacharyc Nov 7, 2025
26ec766
Teeny tweak
dacharyc Nov 7, 2025
91a134a
Remove unneeded comment
dacharyc Nov 7, 2025
bf1d310
Merge pull request #35 from dacharyc/final-cleanup-pass
dacharyc Nov 7, 2025
f694fb0
Resolve Java mismatches with frontend, remove some unused files
dacharyc Nov 7, 2025
0043350
Delete unused files and todo comments
dacharyc Nov 7, 2025
2444b1f
Tiny package.json cleanup
dacharyc Nov 7, 2025
96c784f
Merge pull request #36 from dacharyc/java-mismatches
dacharyc Nov 7, 2025
dde6b3a
Merge main into development
dacharyc Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Git Attributes for docs-sample-apps
# Marks auto-generated files that are committed to version control
# so they're collapsed in GitHub PR diffs and excluded from code review

# Maven Wrapper - Auto-generated by Apache Maven (committed to git)
# See: https://maven.apache.org/wrapper/
server/java-spring/mvnw linguist-generated=true
server/java-spring/mvnw.cmd linguist-generated=true
122 changes: 122 additions & 0 deletions .github/scripts/generate-test-summary-jest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash
set -e

# Generate Detailed Test Summary from Multiple Jest JSON Output Files
# Shows breakdown by test type (unit vs integration)
# Usage: ./generate-test-summary-jest.sh <unit-json> <integration-json>

UNIT_JSON="${1:-}"
INTEGRATION_JSON="${2:-}"

echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Function to parse Jest JSON file
parse_json() {
local json_file="$1"
local test_type="$2"

if [ ! -f "$json_file" ]; then
echo "0 0 0 0"
return
fi

if command -v jq &> /dev/null; then
# Use jq if available (preferred)
total_tests=$(jq -r '.numTotalTests // 0' "$json_file")
passed=$(jq -r '.numPassedTests // 0' "$json_file")
failed=$(jq -r '.numFailedTests // 0' "$json_file")
skipped=$(jq -r '.numPendingTests // 0' "$json_file")
else
# Fallback to grep/sed if jq is not available
total_tests=$(grep -oP '"numTotalTests":\s*\K[0-9]+' "$json_file" | head -1)
passed=$(grep -oP '"numPassedTests":\s*\K[0-9]+' "$json_file" | head -1)
failed=$(grep -oP '"numFailedTests":\s*\K[0-9]+' "$json_file" | head -1)
skipped=$(grep -oP '"numPendingTests":\s*\K[0-9]+' "$json_file" | head -1)
fi

# Default to 0 if values are empty
total_tests=${total_tests:-0}
passed=${passed:-0}
failed=${failed:-0}
skipped=${skipped:-0}

echo "$total_tests $passed $failed $skipped"
}

# Parse both files
read -r unit_tests unit_passed unit_failed unit_skipped <<< "$(parse_json "$UNIT_JSON" "Unit")"
read -r int_tests int_passed int_failed int_skipped <<< "$(parse_json "$INTEGRATION_JSON" "Integration")"

# Calculate totals
total_tests=$((unit_tests + int_tests))
total_passed=$((unit_passed + int_passed))
total_failed=$((unit_failed + int_failed))
total_skipped=$((unit_skipped + int_skipped))

# Display detailed breakdown
echo "### Summary by Test Type" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test Type | Passed | Failed | Skipped | Total |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|--------|--------|---------|-------|" >> $GITHUB_STEP_SUMMARY

if [ -f "$UNIT_JSON" ]; then
echo "| 🔧 Unit Tests | $unit_passed | $unit_failed | $unit_skipped | $unit_tests |" >> $GITHUB_STEP_SUMMARY
fi

if [ -f "$INTEGRATION_JSON" ]; then
echo "| 🔗 Integration Tests | $int_passed | $int_failed | $int_skipped | $int_tests |" >> $GITHUB_STEP_SUMMARY
fi

echo "| **Total** | **$total_passed** | **$total_failed** | **$total_skipped** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Overall status
echo "### Overall Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| ✅ Passed | $total_passed |" >> $GITHUB_STEP_SUMMARY
echo "| ❌ Failed | $total_failed |" >> $GITHUB_STEP_SUMMARY
echo "| ⏭️ Skipped | $total_skipped |" >> $GITHUB_STEP_SUMMARY
echo "| **Total** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# List failed tests if any
if [ $total_failed -gt 0 ]; then
echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

failed_tests_file=$(mktemp)

# Extract failed tests from both files
for json_file in "$UNIT_JSON" "$INTEGRATION_JSON"; do
if [ -f "$json_file" ]; then
if command -v jq &> /dev/null; then
jq -r '.testResults[]? | select(.status == "failed") | .assertionResults[]? | select(.status == "failed") | "\(.ancestorTitles | join(" > ")) > \(.title)"' "$json_file" >> "$failed_tests_file" 2>/dev/null || true
else
# Basic fallback without jq
grep -oP '"fullName":\s*"\K[^"]*' "$json_file" | while read -r line; do
if echo "$line" | grep -q "failed"; then
echo "$line" >> "$failed_tests_file"
fi
done 2>/dev/null || true
fi
fi
done

if [ -s "$failed_tests_file" ]; then
while IFS= read -r test; do
echo "- \`$test\`" >> $GITHUB_STEP_SUMMARY
done < "$failed_tests_file"
else
echo "_Unable to parse individual test names_" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "❌ **Tests failed!**" >> $GITHUB_STEP_SUMMARY
rm -f "$failed_tests_file"
exit 1
else
echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY
fi
109 changes: 109 additions & 0 deletions .github/scripts/generate-test-summary-pytest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/bash
set -e

# Generate Detailed Test Summary from Multiple Pytest JUnit XML Output Files
# Shows breakdown by test type (unit vs integration)
# Usage: ./generate-test-summary-pytest-detailed.sh <unit-xml> <integration-xml>

UNIT_XML="${1:-}"
INTEGRATION_XML="${2:-}"

echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Function to parse XML file
parse_xml() {
local xml_file="$1"
local test_type="$2"

if [ ! -f "$xml_file" ]; then
echo "0 0 0 0 0"
return
fi

tests=$(grep -oP 'tests="\K[0-9]+' "$xml_file" | head -1)
failures=$(grep -oP 'failures="\K[0-9]+' "$xml_file" | head -1)
errors=$(grep -oP 'errors="\K[0-9]+' "$xml_file" | head -1)
skipped=$(grep -oP 'skipped="\K[0-9]+' "$xml_file" | head -1)

tests=${tests:-0}
failures=${failures:-0}
errors=${errors:-0}
skipped=${skipped:-0}
passed=$((tests - failures - errors - skipped))

echo "$tests $failures $errors $skipped $passed"
}

# Parse both files
read -r unit_tests unit_failures unit_errors unit_skipped unit_passed <<< "$(parse_xml "$UNIT_XML" "Unit")"
read -r int_tests int_failures int_errors int_skipped int_passed <<< "$(parse_xml "$INTEGRATION_XML" "Integration")"

# Calculate totals
total_tests=$((unit_tests + int_tests))
total_failures=$((unit_failures + int_failures))
total_errors=$((unit_errors + int_errors))
total_skipped=$((unit_skipped + int_skipped))
total_passed=$((unit_passed + int_passed))
total_failed=$((total_failures + total_errors))

# Display detailed breakdown
echo "### Summary by Test Type" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test Type | Passed | Failed | Skipped | Total |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|--------|--------|---------|-------|" >> $GITHUB_STEP_SUMMARY

if [ -f "$UNIT_XML" ]; then
echo "| 🔧 Unit Tests | $unit_passed | $((unit_failures + unit_errors)) | $unit_skipped | $unit_tests |" >> $GITHUB_STEP_SUMMARY
fi

if [ -f "$INTEGRATION_XML" ]; then
echo "| 🔗 Integration Tests | $int_passed | $((int_failures + int_errors)) | $int_skipped | $int_tests |" >> $GITHUB_STEP_SUMMARY
fi

echo "| **Total** | **$total_passed** | **$total_failed** | **$total_skipped** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Overall status
echo "### Overall Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| ✅ Passed | $total_passed |" >> $GITHUB_STEP_SUMMARY
echo "| ❌ Failed | $total_failed |" >> $GITHUB_STEP_SUMMARY
echo "| ⏭️ Skipped | $total_skipped |" >> $GITHUB_STEP_SUMMARY
echo "| **Total** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# List failed tests if any
if [ $total_failed -gt 0 ]; then
echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

failed_tests_file=$(mktemp)

# Extract failed tests from both files
for xml_file in "$UNIT_XML" "$INTEGRATION_XML"; do
if [ -f "$xml_file" ]; then
grep -oP '<testcase[^>]*classname="[^"]*"[^>]*name="[^"]*"[^>]*>.*?<(failure|error)' "$xml_file" | \
grep -oP 'classname="\K[^"]*|name="\K[^"]*' | \
paste -d '.' - - >> "$failed_tests_file" 2>/dev/null || true
fi
done

if [ -s "$failed_tests_file" ]; then
while IFS= read -r test; do
echo "- \`$test\`" >> $GITHUB_STEP_SUMMARY
done < "$failed_tests_file"
else
echo "_Unable to parse individual test names_" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "❌ **Tests failed!**" >> $GITHUB_STEP_SUMMARY
rm -f "$failed_tests_file"
exit 1
else
echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY
fi

82 changes: 82 additions & 0 deletions .github/scripts/generate-test-summary-surefire.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash
set -e

# Generate Test Summary from Maven Surefire Reports
# Usage: ./generate-test-summary-surefire.sh <path-to-surefire-reports>

REPORTS_DIR="${1:-target/surefire-reports}"

echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Parse test results from Surefire reports
if [ -d "$REPORTS_DIR" ]; then
total_tests=0
failures=0
errors=0
skipped=0
failed_tests_file=$(mktemp)

for file in "$REPORTS_DIR"/TEST-*.xml; do
if [ -f "$file" ]; then
# Extract test counts from XML
tests=$(grep -oP 'tests="\K[0-9]+' "$file" | head -1)
fails=$(grep -oP 'failures="\K[0-9]+' "$file" | head -1)
errs=$(grep -oP 'errors="\K[0-9]+' "$file" | head -1)
skip=$(grep -oP 'skipped="\K[0-9]+' "$file" | head -1)

total_tests=$((total_tests + ${tests:-0}))
failures=$((failures + ${fails:-0}))
errors=$((errors + ${errs:-0}))
skipped=$((skipped + ${skip:-0}))

# Extract failed test cases
if [ "${fails:-0}" -gt 0 ] || [ "${errs:-0}" -gt 0 ]; then
classname=$(basename "$file" .xml | sed 's/^TEST-//')

# Find failed testcases (with failure or error elements)
grep -oP '<testcase[^>]*name="[^"]*"[^>]*>.*?<(failure|error)' "$file" | \
grep -oP 'name="\K[^"]*' | while read -r testname; do
echo "$classname.$testname" >> "$failed_tests_file"
done
fi
fi
done

passed=$((total_tests - failures - errors - skipped))

echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| ✅ Passed | $passed |" >> $GITHUB_STEP_SUMMARY
echo "| ❌ Failed | $((failures + errors)) |" >> $GITHUB_STEP_SUMMARY
echo "| ⏭️ Skipped | $skipped |" >> $GITHUB_STEP_SUMMARY
echo "| **Total** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# List failed tests if any
if [ $((failures + errors)) -gt 0 ]; then
echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ -s "$failed_tests_file" ]; then
while IFS= read -r test; do
echo "- \`$test\`" >> $GITHUB_STEP_SUMMARY
done < "$failed_tests_file"
else
echo "_Unable to parse individual test names_" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "❌ **Tests failed!**" >> $GITHUB_STEP_SUMMARY
rm -f "$failed_tests_file"
exit 1
else
echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY
fi

rm -f "$failed_tests_file"
else
echo "⚠️ No test results found at: $REPORTS_DIR" >> $GITHUB_STEP_SUMMARY
exit 1
fi

70 changes: 70 additions & 0 deletions .github/workflows/run-express-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run Express Tests

on:
pull_request_target:
branches:
- development
paths:
- 'server/js-express/**'
push:
branches:
- development
paths:
- 'server/js-express/**'

jobs:
test:
name: Run Express Tests
runs-on: ubuntu-latest
# Require manual approval for fork PRs
environment: testing

defaults:
run:
working-directory: server/js-express

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run unit tests
run: npm run test:unit -- --json --outputFile=test-results-unit.json || true
env:
MONGODB_URI: ${{ secrets.MFLIX_URI }}

- name: Run integration tests
run: npm run test:integration -- --json --outputFile=test-results-integration.json || true
env:
MONGODB_URI: ${{ secrets.MFLIX_URI }}
ENABLE_SEARCH_TESTS: true
VOYAGE_API_KEY: ${{ secrets.VOYAGE_AI }}

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
server/js-express/coverage/
server/js-express/test-results-unit.json
server/js-express/test-results-integration.json
retention-days: 30

- name: Generate Test Summary
if: always()
working-directory: .
run: |
chmod +x .github/scripts/generate-test-summary-jest.sh
.github/scripts/generate-test-summary-jest.sh \
server/js-express/test-results-unit.json \
server/js-express/test-results-integration.json
Loading