Skip to content

Commit

Permalink
fix: extraction tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalee committed Sep 23, 2024
1 parent b373fae commit 0ff3f4a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,46 +370,46 @@ describe('ExtractionTable', () => {
});
});

it('should sort by doi desc', () => {
cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();

cy.wait('@studysetFixture').then((studysetFixture) => {
const studyset = studysetFixture.response?.body as StudysetReturn;
const studies = [...(studyset.studies || [])] as StudyReturn[];

const sortedStudies = studies.sort((a, b) =>
(b.doi as string).localeCompare(a.doi as string)
);

console.log(sortedStudies);

cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td').eq(4).should('have.text', sortedStudies[index].doi);
});
});
});
});
it('should sort by doi asc', () => {
cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
cy.get('[data-testid="ArrowUpwardIcon"]').should('exist');

cy.wait('@studysetFixture').then((studysetFixture) => {
const studyset = studysetFixture.response?.body as StudysetReturn;
const studies = [...(studyset.studies || [])] as StudyReturn[];

const sortedStudies = studies.sort((a, b) =>
(a.doi as string).localeCompare(b.doi as string)
);

cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td').eq(4).should('have.text', sortedStudies[index].doi);
});
});
});
});
// it('should sort by doi desc', () => {
// cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();

// cy.wait('@studysetFixture').then((studysetFixture) => {
// const studyset = studysetFixture.response?.body as StudysetReturn;
// const studies = [...(studyset.studies || [])] as StudyReturn[];

// const sortedStudies = studies.sort((a, b) =>
// (b.doi as string).localeCompare(a.doi as string)
// );

// console.log(sortedStudies);

// cy.get('tbody > tr').each((tr, index) => {
// cy.wrap(tr).within(() => {
// cy.get('td').eq(4).should('have.text', sortedStudies[index].doi);
// });
// });
// });
// });
// it('should sort by doi asc', () => {
// cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
// cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
// cy.get('[data-testid="ArrowUpwardIcon"]').should('exist');

// cy.wait('@studysetFixture').then((studysetFixture) => {
// const studyset = studysetFixture.response?.body as StudysetReturn;
// const studies = [...(studyset.studies || [])] as StudyReturn[];

// const sortedStudies = studies.sort((a, b) =>
// (a.doi as string).localeCompare(b.doi as string)
// );

// cy.get('tbody > tr').each((tr, index) => {
// cy.wrap(tr).within(() => {
// cy.get('td').eq(4).should('have.text', sortedStudies[index].doi);
// });
// });
// });
// });

it('should sort by pmid desc', () => {
cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click();
Expand All @@ -424,21 +424,19 @@ describe('ExtractionTable', () => {
})
);

console.log(sortedStudies);

cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td')
.eq(5)
.eq(4)
.should('have.text', sortedStudies[index].pmid ?? '');
});
});
});
});

it('should sort by pmid asc', () => {
cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click();
cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click();
cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click();
cy.get('[data-testid="ArrowUpwardIcon"]').should('exist');

cy.wait('@studysetFixture').then((studysetFixture) => {
Expand Down Expand Up @@ -487,7 +485,7 @@ describe('ExtractionTable', () => {
cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td')
.eq(6)
.eq(5)
.within(() => {
const studyStatus = sortedStudies[index].status;
const buttonIndex =
Expand Down Expand Up @@ -545,7 +543,7 @@ describe('ExtractionTable', () => {
cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td')
.eq(6)
.eq(5)
.within(() => {
const studyStatus = sortedStudies[index].status;
const buttonIndex =
Expand Down
2 changes: 1 addition & 1 deletion compose/neurosynth_compose/openapi

0 comments on commit 0ff3f4a

Please sign in to comment.