Add test
This commit is contained in:
parent
946cc35ff7
commit
dc8e54cd84
|
@ -171,9 +171,28 @@ describe("/users", () => {
|
|||
.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(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
true,
|
||||
{ [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.')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue