Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Enable handling of partial node response success #97

Merged
merged 23 commits into from
Apr 9, 2024
Merged

Conversation

surchs
Copy link
Contributor

@surchs surchs commented Mar 26, 2024

Changes proposed in this pull request:

  • Refactored mocked API responses into
    • query response section
    • attribute response section
  • reused most of the responses to make the mocks less cluttered / easier to understand
  • added an e2e test for the "happy path" of the app to assert that no warnings are shown
  • expanded the API request tests to cover the new partial and complete success and failure cases for attribute requests
  • updated the types in the ResultsContainer

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

rmanaem and others added 7 commits March 25, 2024 14:40
Make sure the app loads with no errors if all
required information is provided.
Split the tests into
- attribute requests
- query requests

and into
- success
- partial success
- failure
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for neurobagel-query ready!

Name Link
🔨 Latest commit 613365c
🔍 Latest deploy log https://app.netlify.com/sites/neurobagel-query/deploys/6615af50a0734b0008411d0d
😎 Deploy Preview https://deploy-preview-97--neurobagel-query.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@surchs surchs marked this pull request as ready for review March 26, 2024 18:27
Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

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

Thanks for taking over this @surchs!
The refactor looks clean and nicely done.
🍒 One thing I noticed is missing is handling failure case for attributes and query response.

src/App.tsx Show resolved Hide resolved
cypress/e2e/Form.cy.ts Show resolved Hide resolved
cypress/e2e/APIRequests.cy.ts Outdated Show resolved Hide resolved
cypress/e2e/APIRequests.cy.ts Show resolved Hide resolved
@rmanaem
Copy link
Contributor

rmanaem commented Apr 2, 2024

added an e2e test for the "happy path" of the app to assert that no warnings are shown

Is this referring to this test?

describe('Successful API attribute responses', () => {
beforeEach(() => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
},
nodeOptions
).as('getNodes');
cy.intercept(
{
method: 'GET',
url: '/attributes/nb:Diagnosis',
},
diagnosisOptions
).as('getDiagnosisOptions');
cy.intercept(
{
method: 'GET',
url: '/attributes/nb:Assessment',
},
assessmentToolOptions
).as('getAssessmentToolOptions');
cy.visit('/');
cy.wait(['@getNodes', '@getDiagnosisOptions', '@getAssessmentToolOptions']);
});
it('Loads correctly if all node responses are successful', () => {
cy.get('.notistack-SnackbarContainer').should('not.exist');
});

@surchs
Copy link
Contributor Author

surchs commented Apr 5, 2024

added an e2e test for the "happy path" of the app to assert that no warnings are shown

Is this referring to this test?

describe('Successful API attribute responses', () => {
beforeEach(() => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
},
nodeOptions
).as('getNodes');
cy.intercept(
{
method: 'GET',
url: '/attributes/nb:Diagnosis',
},
diagnosisOptions
).as('getDiagnosisOptions');
cy.intercept(
{
method: 'GET',
url: '/attributes/nb:Assessment',
},
assessmentToolOptions
).as('getAssessmentToolOptions');
cy.visit('/');
cy.wait(['@getNodes', '@getDiagnosisOptions', '@getAssessmentToolOptions']);
});
it('Loads correctly if all node responses are successful', () => {
cy.get('.notistack-SnackbarContainer').should('not.exist');
});

Yes, exactly!

@surchs surchs requested a review from rmanaem April 5, 2024 15:54
@surchs surchs added the pr-minor-breaking Feature or enhancement that breaks compatibility, will increment minor version (0.+1.0) label Apr 8, 2024
Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

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

🍒

cypress/e2e/APIRequests.cy.ts Outdated Show resolved Hide resolved
cypress/e2e/APIRequests.cy.ts Outdated Show resolved Hide resolved
cypress/e2e/APIRequests.cy.ts Outdated Show resolved Hide resolved
cypress/e2e/APIRequests.cy.ts Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
@surchs surchs requested a review from rmanaem April 9, 2024 21:13
Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

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

🧑‍🍳

@surchs surchs merged commit a4de207 into main Apr 9, 2024
9 checks passed
@surchs surchs deleted the feat-60 branch April 9, 2024 22:19
@surchs
Copy link
Contributor Author

surchs commented Apr 11, 2024

🚀 PR was released in v0.2.0 🚀

@surchs surchs added the released This issue/pull request has been released. label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-minor-breaking Feature or enhancement that breaks compatibility, will increment minor version (0.+1.0) released This issue/pull request has been released.
Projects
None yet
2 participants