Skip to content

Added new validations for CBIO#221

Merged
cawohnjing merged 2 commits into
mainfrom
cbio-synthetic-monitoring-new
Oct 6, 2025
Merged

Added new validations for CBIO#221
cawohnjing merged 2 commits into
mainfrom
cbio-synthetic-monitoring-new

Conversation

@cawohnjing
Copy link
Copy Markdown
Contributor

Added new frontend and backend validations.

@cawohnjing cawohnjing self-assigned this Oct 1, 2025
Comment thread monitoring/FNL-Monitoring-List.csv Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds JavaScript-based validation scripts for cBioPortal endpoints in the CCDI monitoring configuration. The validations ensure proper functionality of both the frontend portal and backend API services.

Key Changes:

  • Added HTTP validation script for the cBioPortal dev portal endpoint
  • Added API validation script for the cBioPortal dev API endpoint
  • Implemented response checks for HTML structure, status codes, and API data format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


assert.equal(response.statusCode, 200, 'Expected a 200 OK response.');
assert.ok(Array.isArray(body), 'Expected response body to be an array.');

Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing body[0] without checking if the array is empty will throw an error if the API returns an empty array. Add a length check before accessing the first element.

Suggested change
assert.ok(body.length > 0, 'Expected response array to have at least one element.');

Copilot uses AI. Check for mistakes.
Comment on lines +787 to +789
assert.ok(Array.isArray(body), 'Expected response body to be an array.');

const firstObj = body[0]
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body response from an HTTP request is typically a string that needs to be parsed as JSON before checking if it's an array. The Array.isArray(body) check will always fail for string responses.

Suggested change
assert.ok(Array.isArray(body), 'Expected response body to be an array.');
const firstObj = body[0]
let parsedBody;
try {
parsedBody = JSON.parse(body);
} catch (e) {
throw new Error('Failed to parse response body as JSON: ' + e.message);
}
assert.ok(Array.isArray(parsedBody), 'Expected response body to be an array.');
const firstObj = parsedBody[0]

Copilot uses AI. Check for mistakes.
@cawohnjing cawohnjing requested a review from akmukherjee October 3, 2025 15:21
@akmukherjee
Copy link
Copy Markdown
Contributor

LGTM!

Copy link
Copy Markdown
Contributor

@akmukherjee akmukherjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cawohnjing cawohnjing merged commit 01d3d8c into main Oct 6, 2025
6 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.

4 participants