feat: 切换 schema dump 基线并增强返点结算与管理校验
This commit is contained in:
@@ -28,7 +28,9 @@ test('audit log presenter maps business action and entity target', function ():
|
||||
|
||||
$payload = AuditLogApiPresenter::row($row);
|
||||
|
||||
expect($payload['module_label'])->toBe('代理')
|
||||
expect($payload['operator_label'])->toBe('管理员 #1')
|
||||
->and($payload['operator_subtitle'])->toBeNull()
|
||||
->and($payload['module_label'])->toBe('代理')
|
||||
->and($payload['action_label'])->toBe('同步代理角色权限')
|
||||
->and($payload['target_label'])->toBe('角色 #5');
|
||||
});
|
||||
@@ -106,18 +108,9 @@ test('agent role permission sync records one business audit and skips middleware
|
||||
});
|
||||
|
||||
test('audit log index returns chinese display labels', function (): void {
|
||||
AuditLogger::record(
|
||||
AuditLogger::OPERATOR_ADMIN,
|
||||
1,
|
||||
'agent',
|
||||
'agent_role.sync_permissions',
|
||||
'admin_role',
|
||||
'9',
|
||||
);
|
||||
|
||||
$admin = AdminUser::query()->create([
|
||||
'username' => 'audit_list_super',
|
||||
'name' => 'Super',
|
||||
'name' => '超管甲',
|
||||
'email' => null,
|
||||
'password' => Hash::make('secret-strong'),
|
||||
'status' => 0,
|
||||
@@ -125,10 +118,21 @@ test('audit log index returns chinese display labels', function (): void {
|
||||
grantSuperAdminRole($admin);
|
||||
$token = $admin->createToken('test', ['*'], now()->addDay())->plainTextToken;
|
||||
|
||||
AuditLogger::record(
|
||||
AuditLogger::OPERATOR_ADMIN,
|
||||
(int) $admin->id,
|
||||
'agent',
|
||||
'agent_role.sync_permissions',
|
||||
'admin_role',
|
||||
'9',
|
||||
);
|
||||
|
||||
$this->withHeader('Authorization', 'Bearer '.$token)
|
||||
->getJson('/api/v1/admin/audit-logs?per_page=5')
|
||||
->assertOk()
|
||||
->assertJsonPath('code', ErrorCode::Success->value)
|
||||
->assertJsonPath('data.items.0.operator_label', '超管甲')
|
||||
->assertJsonPath('data.items.0.operator_subtitle', '管理员 #'.$admin->id)
|
||||
->assertJsonPath('data.items.0.module_label', '代理')
|
||||
->assertJsonPath('data.items.0.action_label', '同步代理角色权限')
|
||||
->assertJsonPath('data.items.0.target_label', '角色 #9');
|
||||
|
||||
Reference in New Issue
Block a user