Skip to content

Commit

Permalink
[MNT] Removed trailing slash from queryURL (#235)
Browse files Browse the repository at this point in the history
* Removed trailing slash from `queryURL`

* Updated tests

* Removed trailing slash from `nodesURL`

* Updated tests
  • Loading branch information
rmanaem authored Aug 2, 2024
1 parent d73211c commit 0c38fc3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions cypress/e2e/APIRequests.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Successful API attribute responses', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Partially successful API attribute responses', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Failed API attribute responses', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -156,15 +156,15 @@ describe('Successful API query requests', () => {
cy.intercept(
{
method: 'GET',
url: 'query/?*',
url: 'query?*',
},
mixedResponse
).as('call');

cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('Regression Tests', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -244,15 +244,15 @@ describe('Partially successful API query requests', () => {
cy.intercept(
{
method: 'GET',
url: 'query/?*',
url: 'query?*',
},
partialSuccessMixedResponse
).as('call');

cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down Expand Up @@ -290,15 +290,15 @@ describe('Failed API query requests', () => {
cy.intercept(
{
method: 'GET',
url: 'query/?*',
url: 'query?*',
},
failedQueryResponse
).as('call');

cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/Alert.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Alert', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/Checkbox.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Dataset result checkbox', () => {
cy.intercept(
{
method: 'GET',
url: '/nodes/',
url: '/nodes',
},
nodeOptions
).as('getNodes');
Expand All @@ -34,7 +34,7 @@ describe('Dataset result checkbox', () => {

let isFirstClick = true;

cy.intercept('GET', 'query/*', (req) => {
cy.intercept('GET', 'query*', (req) => {
if (isFirstClick) {
isFirstClick = false;
req.reply(protectedResponse1);
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/ResultsTSV.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mixedResponse, unprotectedResponse } from '../fixtures/mocked-responses

describe('Results TSV', () => {
it('Removes a newline character from a dataset name in the downloaded dataset-level results file', () => {
cy.intercept('query/?*', mixedResponse).as('call');
cy.intercept('query?*', mixedResponse).as('call');
cy.visit('/');
cy.get('[data-cy="submit-query-button"]').click();
cy.wait('@call');
Expand All @@ -11,7 +11,7 @@ describe('Results TSV', () => {
cy.readFile('cypress/downloads/dataset-level-results.tsv').should('contain', 'some cool name');
});
it('Removes the unwanted whitespace from the downloaded results files', () => {
cy.intercept('query/?*', mixedResponse).as('call');
cy.intercept('query?*', mixedResponse).as('call');
cy.visit('/');
cy.get('[data-cy="submit-query-button"]').click();
cy.wait('@call');
Expand All @@ -26,7 +26,7 @@ describe('Results TSV', () => {
});
});
it('Checks whether the protected and unprotected datasets are correctly identified', () => {
cy.intercept('query/?*', mixedResponse).as('call');
cy.intercept('query?*', mixedResponse).as('call');
cy.visit('/');
cy.get('[data-cy="submit-query-button"]').click();
cy.wait('@call');
Expand All @@ -44,7 +44,7 @@ describe('Results TSV', () => {
});
});
it('Checks whether the rows in the participant.tsv file generated according to session_type', () => {
cy.intercept('query/?*', unprotectedResponse).as('call');
cy.intercept('query?*', unprotectedResponse).as('call');
cy.visit('/');
cy.get('[data-cy="submit-query-button"]').click();
cy.wait('@call');
Expand Down
8 changes: 4 additions & 4 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const baseAPIURL: string = import.meta.env.NB_API_QUERY_URL;
export const queryURL: string = baseAPIURL.endsWith('/')
? `${baseAPIURL}query/?`
: `${baseAPIURL}/query/?`;
? `${baseAPIURL}query?`
: `${baseAPIURL}/query?`;
export const attributesURL: string = baseAPIURL.endsWith('/')
? `${baseAPIURL}attributes/`
: `${baseAPIURL}/attributes/`;
export const nodesURL: string = baseAPIURL.endsWith('/')
? `${baseAPIURL}nodes/`
: `${baseAPIURL}/nodes/`;
? `${baseAPIURL}nodes`
: `${baseAPIURL}/nodes`;

export const isFederationAPI: boolean =
import.meta.env.NB_IS_FEDERATION_API === undefined
Expand Down

0 comments on commit 0c38fc3

Please sign in to comment.