Updating test cases based on new user sync and removing old endpoint testcases (endpoint removed).
This commit is contained in:
parent
7da330624f
commit
8f8843aece
|
@ -205,41 +205,4 @@ describe("/users", () => {
|
||||||
expect(res.body.message).toEqual("Flag set successfully")
|
expect(res.body.message).toEqual("Flag set successfully")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("syncUser", () => {
|
|
||||||
it("should sync the user", async () => {
|
|
||||||
let user = await config.createUser()
|
|
||||||
await config.createApp("New App")
|
|
||||||
let res = await request
|
|
||||||
.post(`/api/users/metadata/sync/${user._id}`)
|
|
||||||
.set(config.defaultHeaders())
|
|
||||||
.expect(200)
|
|
||||||
.expect("Content-Type", /json/)
|
|
||||||
expect(res.body.message).toEqual("User synced.")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should sync the user when a previous user is specified", async () => {
|
|
||||||
const app1 = await config.createApp("App 1")
|
|
||||||
const app2 = await config.createApp("App 2")
|
|
||||||
|
|
||||||
let user = await config.createUser({
|
|
||||||
builder: false,
|
|
||||||
admin: true,
|
|
||||||
roles: { [app1.appId]: "ADMIN" },
|
|
||||||
})
|
|
||||||
let res = await request
|
|
||||||
.post(`/api/users/metadata/sync/${user._id}`)
|
|
||||||
.set(config.defaultHeaders())
|
|
||||||
.send({
|
|
||||||
previousUser: {
|
|
||||||
...user,
|
|
||||||
roles: { ...user.roles, [app2.appId]: "BASIC" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.expect(200)
|
|
||||||
.expect("Content-Type", /json/)
|
|
||||||
|
|
||||||
expect(res.body.message).toEqual("User synced.")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -121,7 +121,7 @@ describe("syncGlobalUsers", () => {
|
||||||
await syncGlobalUsers()
|
await syncGlobalUsers()
|
||||||
|
|
||||||
const metadata = await rawUserMetadata()
|
const metadata = await rawUserMetadata()
|
||||||
expect(metadata).toHaveLength(1)
|
expect(metadata).toHaveLength(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue