feat: 完善登录鉴权和超级管理员重置

This commit is contained in:
湛兮
2026-06-12 10:20:10 +08:00
parent 125042f927
commit c8716b3a1a
15 changed files with 206 additions and 37 deletions
@@ -125,10 +125,12 @@ describe('DeployExecutionService', () => {
repository: DeployRunRepository,
idempotencyKey: string,
): Promise<DeployRunSummary> {
return repository.create({
const result = await repository.create({
...input,
idempotencyKey,
});
return result.run;
}
function step(run: DeployRunSummary, bpmnNodeId: string) {
+19 -7
View File
@@ -20,6 +20,7 @@ import { DeployRunsService } from './deploy-runs.service';
describe('DeployRunsService', () => {
const baseRun: DeployRunSummary = {
id: 'run_001',
version: 1,
projectKey: 'access-manage',
environment: 'test',
ref: 'develop',
@@ -61,13 +62,16 @@ describe('DeployRunsService', () => {
),
create: jest.fn((input: CreateDeployRunInput) =>
Promise.resolve({
...baseRun,
id: input.idempotencyKey ?? 'generated_run',
projectKey: input.projectKey,
environment: input.environment,
ref: input.ref,
operator: input.operator,
trigger: input.trigger ?? 'manual',
run: {
...baseRun,
id: input.idempotencyKey ?? 'generated_run',
projectKey: input.projectKey,
environment: input.environment,
ref: input.ref,
operator: input.operator,
trigger: input.trigger ?? 'manual',
},
created: true,
}),
),
updateRun: jest.fn((id: string, patch: { status?: DeployRunStatus }) =>
@@ -270,6 +274,10 @@ describe('DeployRunsService', () => {
environment: 'production',
ref: 'master',
operator: 'ops-admin',
productionConfirmation: {
confirmed: true,
summary: '测试已确认生产发布风险',
},
}),
).rejects.toBeInstanceOf(AppError);
expect(repository.create).not.toHaveBeenCalled();
@@ -308,6 +316,10 @@ describe('DeployRunsService', () => {
ref: 'master',
operator: 'ops-admin',
idempotencyKey: 'self-managed-master',
productionConfirmation: {
confirmed: true,
summary: '测试已确认生产发布风险',
},
});
expect(run.id).toBe('self-managed-master');