fix: close auth, permission, contract and e2e review blockers
This commit is contained in:
@@ -20,6 +20,52 @@ describe('users service', () => {
|
||||
delMock.mockReset()
|
||||
})
|
||||
|
||||
it('normalizes backend user list payloads that use users/limit/offset fields', async () => {
|
||||
getMock.mockResolvedValue({
|
||||
users: [
|
||||
{
|
||||
id: 7,
|
||||
username: 'e2e_admin',
|
||||
email: 'admin@example.com',
|
||||
nickname: '管理员',
|
||||
status: '1',
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
})
|
||||
|
||||
const { listUsers } = await import('./users')
|
||||
const result = await listUsers({ page: 1, page_size: 20 })
|
||||
|
||||
expect(getMock).toHaveBeenCalledWith('/users', { page: 1, page_size: 20 })
|
||||
expect(result).toEqual({
|
||||
items: [
|
||||
{
|
||||
id: 7,
|
||||
username: 'e2e_admin',
|
||||
email: 'admin@example.com',
|
||||
phone: '',
|
||||
nickname: '管理员',
|
||||
avatar: '',
|
||||
gender: 0,
|
||||
birthday: '',
|
||||
region: '',
|
||||
bio: '',
|
||||
status: 1,
|
||||
last_login_at: '',
|
||||
last_login_ip: '',
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
})
|
||||
})
|
||||
|
||||
it('creates a user through the protected users endpoint', async () => {
|
||||
const payload = {
|
||||
username: 'new-user',
|
||||
|
||||
Reference in New Issue
Block a user