From 2a4d9845200c7a4d815adaed04c3ed50beb88598 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 11 Feb 2024 13:59:14 +0100 Subject: [PATCH] test(api): split test and use `.its` and `.should` Signed-off-by: Max --- cypress/e2e/api/UsersApi.spec.js | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/cypress/e2e/api/UsersApi.spec.js b/cypress/e2e/api/UsersApi.spec.js index e34bd7c9320..9b21899e3fc 100644 --- a/cypress/e2e/api/UsersApi.spec.js +++ b/cypress/e2e/api/UsersApi.spec.js @@ -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) }) })