Remove duplicated assertions

This commit is contained in:
Pedro Silva 2022-12-06 18:20:02 +00:00
parent 327c09c972
commit 4467d2b005
2 changed files with 6 additions and 12 deletions

View File

@ -88,6 +88,8 @@ export default class UserManagementApi {
const response = await this.api.post(`/global/users/`, { body }) const response = await this.api.post(`/global/users/`, { body })
const json = await response.json() const json = await response.json()
expect(response).toHaveStatusCode(200) expect(response).toHaveStatusCode(200)
expect(json._id).toEqual(body._id)
expect(json._rev).not.toEqual(body._rev)
return [response, json] return [response, json]
} }

View File

@ -68,9 +68,7 @@ describe("Internal API - User Management & Permissions", () => {
global: true global: true
} }
} }
const [changedUserResponse, changedUserJson] = await config.userManagement.changeUserInformation(body) await config.userManagement.changeUserInformation(body)
expect(changedUserJson._id).toEqual(userJson.created.successful[0]._id)
expect(changedUserJson._rev).not.toEqual(userJson.created.successful[0]._rev)
const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(userJson.created.successful[0]._id) const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(userJson.created.successful[0]._id)
expect(changedUserInfoJson.builder?.global).toBeDefined() expect(changedUserInfoJson.builder?.global).toBeDefined()
@ -92,9 +90,7 @@ describe("Internal API - User Management & Permissions", () => {
[app.appId?.toString() || ""]: "BASIC", [app.appId?.toString() || ""]: "BASIC",
} }
} }
const [changedUserResponse, changedUserJson] = await config.userManagement.changeUserInformation(body) await config.userManagement.changeUserInformation(body)
expect(changedUserJson._id).toEqual(createUserJson.created.successful[0]._id)
expect(changedUserJson._rev).not.toEqual(createUserJson.created.successful[0]._rev)
const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id) const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined() expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined()
@ -117,9 +113,7 @@ describe("Internal API - User Management & Permissions", () => {
[app.appId?.toString() || ""]: "ADMIN", [app.appId?.toString() || ""]: "ADMIN",
} }
} }
const [changedUserResponse, changedUserJson] = await config.userManagement.changeUserInformation(body) await config.userManagement.changeUserInformation(body)
expect(changedUserJson._id).toEqual(createUserJson.created.successful[0]._id)
expect(changedUserJson._rev).not.toEqual(createUserJson.created.successful[0]._rev)
const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id) const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined() expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined()
@ -142,9 +136,7 @@ describe("Internal API - User Management & Permissions", () => {
[app.appId?.toString() || ""]: "POWER", [app.appId?.toString() || ""]: "POWER",
} }
} }
const [changedUserResponse, changedUserJson] = await config.userManagement.changeUserInformation(body) await config.userManagement.changeUserInformation(body)
expect(changedUserJson._id).toEqual(createUserJson.created.successful[0]._id)
expect(changedUserJson._rev).not.toEqual(createUserJson.created.successful[0]._rev)
const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id) const [changedUserInfoResponse, changedUserInfoJson] = await config.userManagement.getUserInformation(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined() expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined()