Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation

Description

Adds comprehensive test coverage for 4 previously untested API endpoints in apps/server/src/routes/v1 and enhances 3 existing test files with extensive payload variations.

Test Files Added (4 new files, 30 tests)

  • monitors/results/get.test.ts (7 tests) - GET /v1/monitor/{id}/result/{resultId} endpoint
  • monitors/run/post.test.ts (7 tests) - POST /v1/monitor/{id}/run endpoint with no-wait parameter support
  • monitors/trigger/post.test.ts (7 tests) - POST /v1/monitor/{id}/trigger endpoint
  • statusReports/update/post.test.ts (9 tests) - POST /v1/status_report/{id}/update deprecated endpoint

Test Files Enhanced (3 existing files, 44 tests)

  • monitors/post_tcp.test.ts (14 tests, was 3) - POST /v1/monitor/tcp endpoint:

    • Different ports: 80 (HTTP), 443 (HTTPS), 8080 (custom)
    • All frequencies: 30s, 1m, 5m, 10m, 30m, 1h
    • Configuration variants: timeout, retry, degradedAfter, description
    • OpenTelemetry configuration with custom headers
    • Multiple regions support (ams, gru, syd)
    • Public/private and active/inactive monitors
    • Minimal payload (only required fields)
    • Invalid payloads: empty host, invalid port type
    • Deprecated regions validation
  • monitors/post_http.test.ts (16 tests, was 3) - POST /v1/monitor/http endpoint:

    • HTTP methods: GET, POST, PUT, PATCH, DELETE
    • Assertion types: statusCode, header, textBody, multiple assertions
    • Different frequencies: 30s, 1h
    • Configuration variants: timeout, retry, degradedAfter
    • OpenTelemetry configuration with custom headers
    • Minimal payload (only required fields)
    • Invalid payloads: invalid URL, deprecated regions
  • statusReportUpdates/post.test.ts (14 tests, was 3) - POST /v1/status_report_update endpoint:

    • All status types: investigating, identified, monitoring, resolved
    • Date handling: with/without explicit date, past dates
    • Message variants: long messages, different status report IDs
    • Invalid payloads: invalid status, missing fields, empty message

Coverage

Each test suite validates:

  • Success paths (200)
  • Invalid resource IDs (404)
  • Missing authentication (401)
  • Cross-workspace isolation (404)
  • Input validation (400)
  • Different payload variations (HTTP methods, TCP/HTTP monitors, multiple regions, various status values, configuration options)

Total: 74 test cases, 1200+ LOC. Tests follow existing patterns from check/http/post.test.ts including mock fetch setup for external HTTP calls and schema validation for responses.

Different Payload Test Cases Added

  • Monitor Run/Trigger Tests: HTTP vs TCP monitor types, single vs multiple regions
  • Status Report Update Tests: Different status variants (investigating, monitoring, identified, resolved), with/without explicit date
  • Monitor Results Tests: TCP monitor result retrieval, non-matching result ID validation
  • TCP Monitor Creation Tests: Different ports, all frequency options, configuration variants, OpenTelemetry integration, validation tests
  • HTTP Monitor Creation Tests: All major HTTP methods, assertion types, frequencies, configuration options, OpenTelemetry integration
  • Status Report Update Tests: All status types, date handling variants, message variations, comprehensive validation

A picture tells a thousand words (if any)

N/A - Test coverage only

Before this PR

4 endpoint implementations without test coverage; 3 existing test files (TCP monitor, HTTP monitor, status report updates) had only 3 basic test cases each

After this PR

Complete test coverage for all v1 route endpoints with comprehensive payload variation testing; enhanced test files now have 14-16 test cases each covering all configuration options, HTTP methods, assertion types, and edge cases

Original prompt

generate more test for our api endpoint n this directory
apps/server/src/routes/v1

you have an example here

apps/server/src/routes/v1/check/http/post.test.ts

you should add more tests case


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jan 4, 2026
@vercel
Copy link

vercel bot commented Jan 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Review Updated (UTC)
openstatus-dashboard Skipped Skipped Jan 5, 2026 4:54pm
openstatus-status-page Skipped Skipped Jan 5, 2026 4:54pm
openstatus-web Skipped Skipped Jan 5, 2026 4:54pm

@vercel vercel bot temporarily deployed to Preview – openstatus-web January 4, 2026 20:45 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 4, 2026 20:45 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 4, 2026 20:45 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 4, 2026 20:48 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 4, 2026 20:48 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 4, 2026 20:48 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 4, 2026 20:51 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 4, 2026 20:51 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 4, 2026 20:51 Inactive
Copilot AI changed the title [WIP] Add more tests for API endpoint in v1 routes Add test coverage for 4 untested v1 API endpoints Jan 4, 2026
Copilot AI requested a review from thibaultleouay January 4, 2026 20:56
@thibaultleouay
Copy link
Member

@copilot also add missing test case with different payload in existing test

- Add TCP monitor tests for run and trigger endpoints
- Add multiple region tests for run and trigger endpoints
- Add different status tests for status report updates
- Add result validation tests for monitor results endpoint
- Total: 8 new test cases across 4 test files

Co-authored-by: thibaultleouay <[email protected]>
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 4, 2026 21:01 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 4, 2026 21:01 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 4, 2026 21:01 Inactive
Copy link
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot also add missing test case with different payload in existing test

Added 8 new test cases with different payloads across all 4 test files:

Monitor Run (run/post.test.ts):

  • TCP monitor test with jobType validation
  • Multiple regions test returning array

Monitor Trigger (trigger/post.test.ts):

  • TCP monitor trigger test
  • Multiple regions trigger test

Status Report Update (update/post.test.ts):

  • Resolved status variant
  • Update without explicit date (testing defaults)

Monitor Results (results/get.test.ts):

  • TCP monitor result retrieval
  • Non-matching result ID validation

Commit: c604daf

@thibaultleouay
Copy link
Member

For example

In this file apps/server/src/routes/v1/monitors/post_tcp.test.ts

You should add more test case with different payload @copilot

Copilot AI changed the title Add test coverage for 4 untested v1 API endpoints Add comprehensive test coverage for 4 untested v1 API endpoints with different payload variations Jan 4, 2026
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:28 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:28 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:46 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 5, 2026 16:46 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:46 Inactive
@thibaultleouay thibaultleouay force-pushed the copilot/add-more-api-endpoint-tests branch from b4e2533 to b3464c1 Compare January 5, 2026 16:50
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 5, 2026 16:50 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:50 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:50 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 5, 2026 16:51 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:51 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:51 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 5, 2026 16:53 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:53 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:53 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-dashboard January 5, 2026 16:54 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-web January 5, 2026 16:54 Inactive
@vercel vercel bot temporarily deployed to Preview – openstatus-status-page January 5, 2026 16:54 Inactive
@thibaultleouay thibaultleouay merged commit a4060e8 into main Jan 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants