feat(M08-B): 补保洁员资料细节
This commit is contained in:
@@ -50,6 +50,7 @@ const token = signAccessToken({
|
||||
}, secret, 900);
|
||||
let createdInput;
|
||||
let listedInput;
|
||||
let updatedInput;
|
||||
const app = await buildApp({
|
||||
userManagement: {
|
||||
jwtSecret: secret,
|
||||
@@ -81,7 +82,10 @@ const app = await buildApp({
|
||||
createdInput = input;
|
||||
return { userId: '22' };
|
||||
},
|
||||
async updateUser() { return { userId: '22' }; },
|
||||
async updateUser(_actor, _userId, input) {
|
||||
updatedInput = input;
|
||||
return { userId: '22' };
|
||||
},
|
||||
async resetSessions() { return { userId: '22', revokedSessions: 2 }; }
|
||||
}
|
||||
}
|
||||
@@ -111,6 +115,22 @@ assert.equal(listedInput.role, 'CLEANER');
|
||||
assert.equal(listedInput.status, 'ACTIVE');
|
||||
assert.equal(listedInput.search, '保洁');
|
||||
|
||||
const updated = await app.inject({
|
||||
method: 'PATCH',
|
||||
url: '/admin-api/users/22',
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: {
|
||||
nickname: '保洁一号',
|
||||
phone: '13800138009',
|
||||
roles: ['CLEANER'],
|
||||
storeIds: ['11'],
|
||||
note: '夜班'
|
||||
}
|
||||
});
|
||||
assert.equal(updated.statusCode, 200);
|
||||
assert.equal(updatedInput.phone, '13800138009');
|
||||
assert.deepEqual(updatedInput.roles, ['CLEANER']);
|
||||
|
||||
const unauthenticated = await app.inject({ method: 'GET', url: '/admin-api/users' });
|
||||
assert.equal(unauthenticated.statusCode, 401);
|
||||
await app.close();
|
||||
|
||||
Reference in New Issue
Block a user