Skip to content

Commit

Permalink
test(api): split test and use .its and .should
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed May 28, 2024
1 parent 615c4b3 commit 2a4d984
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions cypress/e2e/api/UsersApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,22 @@ describe('The user mention API', function() {
})

it('fetches users with valid session', function() {
cy.sessionUsers(this.connection)
.its('status').should('eq', 200)
})

cy.sessionUsers(this.connection).then(({ status }) => {
expect(status).to.eq(200)
})

it('rejects invalid sessions', function() {
cy.sessionUsers(this.connection, { sessionToken: 'invalid' })
.then(({ status }) => {
expect(status).to.eq(403)
})

.its('status').should('eq', 403)
cy.sessionUsers(this.connection, { sessionId: 0 })
.then(({ status }) => {
expect(status).to.eq(403)
})

.its('status').should('eq', 403)
cy.sessionUsers(this.connection, { documentId: 0 })
.then(({ status }) => {
expect(status).to.eq(403)
})
.its('status').should('eq', 403)
})

it('rejects closed sessions', function() {
cy.then(() => this.connection.close())

cy.sessionUsers(this.connection).then(({ status }) => {
expect(status).to.eq(403)
})
cy.sessionUsers(this.connection)
.its('status').should('eq', 403)
})
})

0 comments on commit 2a4d984

Please sign in to comment.