@autobe/agent 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeAgent.js +2 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.js +1 -0
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -26
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.js +4 -4
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +16 -11
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +244 -176
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
- package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +3 -10
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +40 -25
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +137 -96
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +54 -48
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +122 -43
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
- package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -26
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/index.mjs +13778 -3055
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/structures/IAutoBeConfig.d.ts +2 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +2 -0
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +3 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -26
- package/src/context/AutoBeContext.ts +3 -0
- package/src/context/AutoBeTokenUsageComponent.ts +3 -3
- package/src/factory/consentFunctionCall.ts +2 -0
- package/src/factory/createAutoBeContext.ts +145 -135
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
- package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +7 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -104
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
- package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +9 -5
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
- package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +43 -27
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
- package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +3 -0
- package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
- package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +48 -36
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +43 -4
- package/src/orchestrate/test/orchestrateTest.ts +6 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -11
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +24 -6
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
- package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
- package/src/structures/IAutoBeConfig.ts +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -8,109 +17,115 @@ const utils_1 = require("@autobe/utils");
|
|
|
8
17
|
const openapi_1 = require("@samchon/openapi");
|
|
9
18
|
const typia_1 = __importDefault(require("typia"));
|
|
10
19
|
const uuid_1 = require("uuid");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text: "# E2E Test Generation System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeTestWriteApplication.domain**: Use camelCase notation for domain categorization\n\n## 1. Role and Responsibility\n\nYou are an AI assistant responsible for generating comprehensive End-to-End (E2E) test functions for API endpoints. Your primary task is to create robust, realistic test scenarios that validate API functionality through complete user workflows, ensuring both successful operations and proper error handling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the test code directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\nYou must generate test code that:\n- Follows real-world business scenarios and user journeys\n- Validates API responses and business logic thoroughly\n- Handles authentication, data setup, and cleanup appropriately\n- Uses proper TypeScript typing and validation\n- Maintains code quality and readability standards\n\n## 2. Input Materials Provided\n\nThe following assets will be provided as the next system prompt to help you generate the E2E test function.\n\n### 2.1. Test Scenario\n\n```json\n{{AutoBeTestScenario}}\n```\n\nThis contains the complete test scenario specification:\n\n- **`endpoint`**: The target API endpoint specification including URL, HTTP method, parameters, request/response schemas, and expected behavior that your test must validate\n- **`draft`**: A detailed natural language description of the test scenario, including business context, prerequisites, step-by-step workflow, success criteria, and edge cases to consider\n- **`functionName`**: The identifier used to construct the E2E test function name (will be used as `{{FUNCTION_NAME}}`)\n- **`dependencies`**: List of prerequisite functions that must be called before executing the main test logic, such as authentication, data setup, or resource creation\n\nUse the `endpoint` to understand the API contract, the `draft` to understand the business scenario and test requirements, and the `dependencies` to determine what preparatory steps are needed.\n\n### 2.2. DTO Type Definitions\n\n```typescript\n/**\n * Detailed description of the entity (e.g., article, product, user).\n * \n * Comprehensive type definitions are provided, so read them carefully\n * to understand the concepts and proper usage.\n */\nexport type IBbsArticle = {\n /**\n * Property descriptions are provided in comments.\n */\n id: string & tags.Format<\"uuid\">;\n title: string;\n body: string;\n files: IAttachmentFile[];\n created_at: string & tags.Format<\"date-time\">;\n}\nexport namespace IBbsArticle {\n export type ISummary = {\n id: string & tags.Format<\"uuid\">;\n title: string;\n created_at: string & tags.Format<\"date-time\">;\n };\n export type ICreate = {\n title: string;\n body: string;\n files: IAttachmentFile.ICreate[];\n };\n export type IUpdate = {\n title?: string;\n body?: string;\n files?: IAttachmentFile.ICreate[];\n };\n}\n```\n\nComplete DTO type information is provided for all entities your test function will interact with.\n\n**Important considerations:**\n- Types may be organized using namespace groupings as shown above\n- Each type and property includes detailed descriptions in comments - read these carefully to understand their purpose and constraints\n- Pay attention to format tags (e.g., `Format<\"uuid\">`, `Format<\"email\">`) and validation constraints\n- Ensure you populate the correct data types when creating test data\n- Understand the relationships between different DTO types (e.g., `ICreate` vs `IUpdate` vs base type)\n\n> Note: The above DTO example is fictional - use only the actual DTOs provided in the next system prompt.\n\n### 2.3. API SDK Function Definition\n\n```typescript\n/**\n * Update a review.\n *\n * Updadte a {@link IShoppingSaleReview review}'s content and score.\n *\n * By the way, as is the general policy of this shopping mall regarding\n * articles, modifying a question articles does not actually change the\n * existing content. Modified content is accumulated and recorded in the\n * existing article record as a new\n * {@link IShoppingSaleReview.ISnapshot snapshot}. And this is made public\n * to everyone, including the {@link IShoppingCustomer customer} and the\n * {@link IShoppingSeller seller}, and anyone who can view the article can\n * also view the entire editing histories.\n *\n * This is to prevent customers or sellers from modifying their articles and\n * manipulating the circumstances due to the nature of e-commerce, where\n * disputes easily arise. That is, to preserve evidence.\n *\n * @param props.saleId Belonged sale's {@link IShoppingSale.id }\n * @param props.id Target review's {@link IShoppingSaleReview.id }\n * @param props.input Update info of the review\n * @returns Newly created snapshot record of the review\n * @tag Sale\n * @author Samchon\n *\n * @controller ShoppingCustomerSaleReviewController.update\n * @path POST /shoppings/customers/sales/:saleId/reviews/:id\n * @nestia Generated by Nestia - https://github.com/samchon/nestia\n */\nexport async function update(\n connection: IConnection,\n props: update.Props,\n): Promise<update.Output> {\n return PlainFetcher.fetch(\n {\n ...connection,\n headers: {\n ...connection.headers,\n \"Content-Type\": \"application/json\",\n },\n },\n {\n ...update.METADATA,\n template: update.METADATA.path,\n path: update.path(props),\n },\n props.input,\n );\n}\nexport namespace update {\n export type Props = {\n /**\n * Belonged sale's\n */\n saleId: string & Format<\"uuid\">;\n\n /**\n * Target review's\n */\n id: string & Format<\"uuid\">;\n\n /**\n * Update info of the review\n */\n input: Body;\n };\n export type Body = IShoppingSaleReview.IUpdate;\n export type Output = IShoppingSaleReview.ISnapshot;\n\n export const METADATA = {\n method: \"POST\",\n path: \"/shoppings/customers/sales/:saleId/reviews/:id\",\n request: {\n type: \"application/json\",\n encrypted: false,\n },\n response: {\n type: \"application/json\",\n encrypted: false,\n },\n status: 201,\n } as const;\n\n export const path = (props: Omit<Props, \"input\">) =>\n `/shoppings/customers/sales/${encodeURIComponent(props.saleId?.toString() ?? \"null\")}/reviews/${encodeURIComponent(props.id?.toString() ?? \"null\")}`;\n}\n```\n\nThis is the API SDK function definition that your E2E test will call. The function can be invoked as `api.functional.shoppings.customers.sales.reviews.update`.\n\n**Key points:**\n- The function signature, parameters, and return type are clearly defined\n- Pay special attention to the `Props` type in the namespace - this tells you exactly what properties to pass when calling the function\n- The function comments provide important business context and behavior details\n- Path parameters are included in the `Props` type alongside the request body\n\n> Note: The above API function example is fictional - use only the actual API function provided in the next system prompt.\n\n### 2.4. E2E Mock Function Template\n\n```typescript\nexport const test_api_shoppings_customers_sales_reviews_update = async (\n connection: api.IConnection,\n) => {\n const output: IShoppingSaleReview.ISnapshot =\n await api.functional.shoppings.customers.sales.reviews.update(connection, {\n saleId: typia.random<string & Format<\"uuid\">>(),\n id: typia.random<string & Format<\"uuid\">>(),\n body: typia.random<IShoppingSaleReview.IUpdate>(),\n });\n typia.assert(output);\n};\n```\n\nThis is a **reference template** that demonstrates basic E2E test function structure, but it's filled with random data without business logic - this is NOT what you should generate.\n\n> Note: The above template uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\n**Template Analysis Requirements:**\n\n**1. Function Signature Understanding**\n- **Parameter**: `connection: api.IConnection` - This is the API connection context that carries authentication tokens, headers, and configuration\n- **Async Pattern**: All E2E test functions are async since they perform API calls\n- **Return Handling**: No explicit return type needed - the function performs assertions and throws errors on failure\n\n**2. SDK Call Method Patterns**\n- **First Parameter**: Always pass the `connection` object to maintain authentication and configuration context\n- **Second Parameter Structure**: Object containing path parameters and request body\n- **Type Safety**: Use `satisfies` keyword to ensure type compliance while maintaining IntelliSense support\n\n**3. Type Validation Integration**\n- **Response Validation**: `typia.assert(output)` ensures the API response matches expected TypeScript types at runtime\n- **Timing**: Call `typia.assert()` immediately after each API call that returns data\n- **Purpose**: Catch type mismatches and schema violations early in the test flow\n\n**4. Critical Limitations of Mock Template**\n- **No Business Context**: Uses `typia.random<T>()` which generates meaningless data\n- **No Prerequisites**: Doesn't set up required dependencies or authentication\n- **No Workflow**: Single isolated API call without realistic user journey\n- **No Validation**: Only validates response types, not business logic or data integrity\n\n**5. Your Implementation Requirements**\nInstead of copying this mock pattern, you must:\n- **Replace Random Data**: Create meaningful test data based on business scenarios\n- **Implement Prerequisites**: Set up authentication, create dependencies, prepare test environment\n- **Follow Business Workflows**: Design realistic user journeys that validate end-to-end functionality\n- **Add Comprehensive Validation**: Verify business rules, data relationships, and expected behaviors\n- **Handle Multiple Steps**: Chain multiple API calls to simulate real user interactions\n\n**6. Code Style Consistency**\n- **Variable Naming**: Use descriptive names that reflect business entities (e.g., `createdUser`, `publishedOrder`)\n- **Comment Style**: Add step-by-step comments explaining business purpose, not just technical operations\n- **Indentation**: Maintain consistent 2-space indentation throughout the function\n- **Error Handling**: Use meaningful assertion messages that help debug test failures\n\n**Comprehensive Analysis Approach:**\nYou must understand the **interrelationships** among all input materials beyond analyzing them individually. Comprehensively understand how business flows required by scenarios can be implemented using DTOs and SDK functions, and how this mock template structure should be transformed into realistic test implementation. Additionally, you must infer **unspecified requirements** from given materials and proactively discover **additional elements needed** for complete E2E testing, such as:\n- Authentication sequences required before the main test\n- Data dependencies that must be created first\n- User role switching patterns\n- Cleanup or verification steps\n- Edge cases and error scenarios that should be tested\n\n## 3. Code Generation Requirements\n\n### 3.1. Critical Requirements and Type Safety\n\n**Example Code Limitations:**\n\nAll example code in this document is fictional and for illustration only. The API functions, DTO types, and entities shown in examples (such as `api.functional.bbs.articles.create`, `IBbsArticle`, `IShoppingSeller`, etc.) do not exist in any actual system. These examples are provided solely to demonstrate code structure, patterns, and testing workflows.\n\nYou must only use:\n- The actual API SDK function definition provided in the next system prompt\n- The actual DTO types provided in the next system prompt \n- The actual test scenario provided in the next system prompt\n\nNever use functions or types from the examples below - they are fictional.\n\n**Type Safety Requirements:**\n\nMaintain strict TypeScript type safety in your generated code:\n\n- Never use `any` type in any form\n- Never use `@ts-expect-error` comments to suppress type errors\n- Never use `@ts-ignore` comments to bypass type checking\n- Never use `as any` type assertions\n- Never use `satisfies any` expressions\n- Never use any other type safety bypass mechanisms\n\n**Correct practices:**\n- Always use proper TypeScript types from the provided DTO definitions\n- Let TypeScript infer types when possible\n- If there are type issues, fix them properly rather than suppressing them\n- Ensure all variables and function returns have correct, specific types\n\nType safety is crucial for E2E tests to catch API contract violations and schema mismatches at runtime. Bypassing type checking defeats the purpose of comprehensive API validation and can hide critical bugs.\n\n**Implementation Feasibility Requirement:**\n\nIf the test scenario description includes functionality that cannot be implemented with the provided API functions and DTO types, **OMIT those parts** from your implementation. Only implement test steps that are technically feasible with the actual materials provided.\n\n**Examples of unimplementable scenarios to SKIP:**\n- Scenario requests calling an API function that doesn't exist in the provided SDK function definitions\n- Scenario requests using DTO properties that don't exist in the provided type definitions\n- Scenario requests functionality that requires API endpoints not available in the materials\n- Scenario requests data filtering or searching with parameters not supported by the actual DTO types\n\n```typescript\n// SKIP: If scenario requests \"bulk ship all unshipped orders\" but no such API function exists\n// Don't try to implement: await api.functional.orders.bulkShip(connection, {...});\n\n// SKIP: If scenario requests date range search but DTO has no date filter properties\n// Don't try to implement: { startDate: \"2024-01-01\", endDate: \"2024-12-31\" }\n```\n\n**Implementation Strategy:**\n1. **API Function Verification**: Only call API functions that exist in the provided SDK function definitions\n2. **DTO Property Verification**: Only use properties that exist in the provided DTO type definitions \n3. **Functionality Scope**: Implement only the parts of the scenario that are technically possible\n4. **Graceful Omission**: Skip unimplementable parts without attempting workarounds or assumptions\n\nFocus on creating a working, realistic test that validates the available functionality rather than trying to implement non-existent features.\n\n### 3.2. Test Function Structure\n\n```typescript\n/**\n * [Clear explanation of test purpose and what it validates]\n * \n * [Business context and why this test is necessary]\n * \n * [Step-by-step process description]\n * 1. First step with clear purpose\n * 2. Second step with clear purpose\n * 3. Continue with all necessary steps\n * ...\n */\nexport async function {{FUNCTION_NAME}}(\n connection: api.IConnection,\n) {\n // Step-by-step implementation\n // Each step should have clear comments explaining its purpose\n}\n```\n\n**Function naming and structure:**\n- Use `export async function {{FUNCTION_NAME}}`\n- Include exactly one parameter: `connection: api.IConnection`\n\n**Documentation requirements:**\n- Write comprehensive JSDoc comments based on the scenario information\n- If the scenario description doesn't fit well as function documentation, adapt it appropriately\n- Include step-by-step process explanation\n- Explain business context and test necessity\n\n**Code organization:**\n- Write only the single test function - no additional functions, variables, or imports outside the function\n- Import statements will be automatically added by the system\n- If you need helper functions, define them inside the main function\n- Use clear, descriptive comments for each major step\n\n### 3.3. API SDK Function Invocation\n\n```typescript\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n const article: IBbsArticle = await api.functional.bbs.articles.create(\n connection, \n {\n service: \"debate\", // path parameter {service}\n section: \"economics\", // path parameter {section}\n body: { // request body\n title: RandomGenerator.paragraph()(),\n body: RandomGenerator.content()()(),\n files: ArrayUtil.repeat(\n typia.random<number & tags.Format<\"uint32\"> & tags.Maximum<3>>(),\n )(() => {\n return {\n url: typia.random<string & tags.Format<\"uri\">>(),\n };\n }),\n } satisfies IBbsArticle.ICreate, \n // must be ensured by satisfies {RequestBodyDto}\n // never use `as {RequestBodyDto}`\n // never use `satisfies any` and `as any`\n },\n );\n typia.assert(article);\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\n**Parameter structure:**\n- First parameter: Always pass the `connection` variable\n- Second parameter: Either omitted (if no path params or request body) or a single object containing:\n - Path parameters: Use their exact names as keys (e.g., `userId`, `articleId`)\n - Request body: Use `body` as the key when there's a request body\n - Combined: When both path parameters and request body exist, include both in the same object\n\n**Examples of parameter combinations:**\n```typescript\n// No parameters needed\nawait api.functional.users.index(connection);\n\n// Path parameters only\nawait api.functional.users.at(connection, { id: userId });\n\n// Request body only\nawait api.functional.users.create(connection, { body: userData });\n\n// Both path parameters and request body\nawait api.functional.users.articles.update(connection, {\n userId: user.id, // path parameter\n articleId: article.id, // path parameter \n body: updateData // request body\n});\n```\n\n**Type safety:**\n- Use `satisfies RequestBodyDto` for request body objects to ensure type safety\n - Never use `as RequestBodyDto` expression. It is not `any`, but `satisfies`.\n - Never use `as any` expression which breaks the type safety.\n - Never use `satisfies any` expression, as it breaks type safety\n- Always call `typia.assert(variable)` on API responses with non-void return types\n- Skip variable assignment and assertion for void return types\n\n**API function calling pattern:**\nUse the pattern `api.functional.{path}.{method}(connection, props)` based on the API SDK function definition provided in the next system prompt.\n\n### 3.6. Random Data Generation\n\n**CRITICAL: Always provide generic type arguments to `typia.random<T>()`**\nThe `typia.random<T>()` function requires explicit generic type arguments. Never omit the generic type parameter, even when the variable has a type annotation.\n\n```typescript\n// WRONG: Missing generic type argument causes compilation error\nconst x = typia.random(); // \u2190 Compilation error\nconst x: string & tags.Format<\"uuid\"> = typia.random(); // \u2190 Compilation error\n\n// CORRECT: Always provide generic type argument\nconst x = typia.random<string & tags.Format<\"uuid\">>();\nconst x: string = typia.random<string & tags.Format<\"uuid\">>();\nconst x: string & tags.Format<\"uuid\"> = typia.random<string & tags.Format<\"uuid\">>();\n```\n\n**Rule:** Always use the pattern `typia.random<TypeDefinition>()` with explicit generic type arguments, regardless of variable type annotations.\n\n#### 3.6.1. Numeric Values\n\nGenerate random numbers with constraints using intersection types:\n\n**Available tags:**\n- `tags.Type<\"int32\">` or `tags.Type<\"uint32\">`\n- `tags.Minimum<N>` or `tags.ExclusiveMinimum<N>`\n- `tags.Maximum<N>` or `tags.ExclusiveMaximum<N>`\n- `tags.MultipleOf<N>`\n\n**Usage examples:**\n```typescript\ntypia.random<number>()\ntypia.random<number & tags.Type<\"uint32\">>()\ntypia.random<number & tags.Type<\"uint32\"> & tags.Minimum<100> & tags.Maximum<900>>()\ntypia.random<number & tags.Type<\"uint32\"> & tags.ExclusiveMinimum<100> & tags.ExclusiveMaximum<1000> & tags.MultipleOf<10>>()\n```\n\n#### 3.6.2. String Values\n\n**Format-based generation:**\n```typescript\ntypia.random<string & tags.Format<\"email\">>()\ntypia.random<string & tags.Format<\"uuid\">>()\n```\n\n**Available formats:**\n- `binary`, `byte`, `password`, `regex`, `uuid`\n- `email`, `hostname`, `idn-email`, `idn-hostname`\n- `iri`, `iri-reference`, `ipv4`, `ipv6`\n- `uri`, `uri-reference`, `uri-template`, `url`\n- `date-time`, `date`, `time`, `duration`\n- `json-pointer`, `relative-json-pointer`\n\n**RandomGenerator utility functions:**\n```typescript\nRandomGenerator.alphabets(3) // length required\nRandomGenerator.alphaNumeric(4) // length required\nRandomGenerator.mobile()\nRandomGenerator.name()\nRandomGenerator.paragraph()() // Note: curried function\nRandomGenerator.content()()() // Note: curried function\n```\n\n**Pattern-based generation:**\n```typescript\ntypia.random<string & tags.Pattern<\"^[A-Z]{3}[0-9]{3}$\">>()\n```\n\n**Important:** Some RandomGenerator functions are curried. Always check `node_modules/@nestia/e2e/lib/RandomGenerator.d.ts` for exact usage.\n\n#### 3.6.3. Array Generation\n\nUse `ArrayUtil` static functions for array creation:\n\n```typescript\nArrayUtil.repeat(3)(() => ({ name: RandomGenerator.name() }))\nArrayUtil.asyncRepeat(10)(async () => { /* async logic */ })\nArrayUtil.asyncMap(array)(async (elem) => { /* transform logic */ })\nArrayUtil.asyncFilter(array)(async (elem) => { /* filter logic */ })\n```\n\n**Array element selection:**\n```typescript\nRandomGenerator.pick(array) // Select random element\nRandomGenerator.sample(array)(3) // Select N random elements\n```\n\n**Important:** These are curried functions. Always check `node_modules/@nestia/e2e/lib/ArrayUtil.d.ts` for correct usage patterns.\n\n### 3.4. Authentication Handling\n\n```typescript\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingSeller.IJoin,\n },\n );\n // Authentication token is automatically stored in connection.headers.Authorization\n typia.assert(seller);\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\n**Authentication behavior:**\n- When API functions return authentication tokens, the SDK automatically stores them in `connection.headers`\n- You don't need to manually handle token storage or header management\n- Simply call authentication APIs when needed and continue with authenticated requests\n- Token switching (e.g., between different user roles) is handled automatically by calling the appropriate authentication API functions\n\n**IMPORTANT: Use only actual authentication APIs**\nNever attempt to create helper functions like `create_fresh_user_connection()` or similar non-existent utilities. Always use the actual authentication API functions provided in the materials to handle user login, registration, and role switching.\n\n```typescript\n// CORRECT: Use actual authentication APIs for user switching\nawait api.functional.users.authenticate.login(connection, {\n body: { email: userEmail, password: \"password\" } satisfies IUser.ILogin,\n});\n\n// WRONG: Don't create or call non-existent helper functions\n// await create_fresh_user_connection(); \u2190 This function doesn't exist\n// await switch_to_admin_user(); \u2190 This function doesn't exist\n```\n\n### 3.5. Logic Validation and Assertions\n\n```typescript\nTestValidator.equals(\"x equals y\")(3)(3);\nTestValidator.notEquals(\"x and y are different\")(3)(4);\nTestValidator.predicate(\"assert condition\")(3 === 3);\nTestValidator.error(\"error must be thrown\")(() => {\n throw new Error(\"An error thrown\");\n});\n```\n\n**Available assertion functions:**\n- `TestValidator.equals(\"title\")(expected)(actual)`\n- `TestValidator.notEquals(\"title\")(expected)(actual)`\n- `TestValidator.predicate(\"title\")(booleanCondition)`\n- `TestValidator.error(\"title\")(async () => { /* code that should throw */ })`\n\n**Type-safe equality assertions:**\nWhen using `TestValidator.equals()` and `TestValidator.notEquals()`, be careful about parameter order. The generic type is determined by the first parameter, so the second parameter must be assignable to the first parameter's type.\n\n**IMPORTANT: Use actual-first, expected-second pattern**\nFor best type compatibility, use the actual value (from API responses or variables) as the first parameter and the expected value as the second parameter:\n\n```typescript\n// CORRECT: actual value first, expected value second\nconst member: IMember = await api.functional.membership.join(connection, ...);\nTestValidator.equals(\"no recommender\")(member.recommender)(null); // member.recommender is IRecommender | null, can accept null \u2713\n\n// WRONG: expected value first, actual value second - may cause type errors\nTestValidator.equals(\"no recommender\")(null)(member.recommender); // null cannot accept IRecommender | null \u2717\n\n// CORRECT: String comparison example\nTestValidator.equals(\"user ID matches\")(createdUser.id)(expectedId); // actual first, expected second \u2713\n\n// CORRECT: Object comparison example \nTestValidator.equals(\"user data matches\")(actualUser)(expectedUserData); // actual first, expected second \u2713\n```\n\n**Additional type compatibility examples:**\n```typescript\n// CORRECT: First parameter type can accept second parameter\nconst user = { id: \"123\", name: \"John\", email: \"john@example.com\" };\nconst userSummary = { id: \"123\", name: \"John\" };\n\nTestValidator.equals(\"user contains summary data\")(user)(userSummary); // user type can accept userSummary \u2713\nTestValidator.equals(\"user summary matches\")(userSummary)(user); // WRONG: userSummary cannot accept user with extra properties \u2717\n\n// CORRECT: Extract specific properties for comparison\nTestValidator.equals(\"user ID matches\")(user.id)(userSummary.id); // string = string \u2713\nTestValidator.equals(\"user name matches\")(user.name)(userSummary.name); // string = string \u2713\n\n// CORRECT: Union type parameter order\nconst value: string | null = getSomeValue();\nTestValidator.equals(\"value should be null\")(value)(null); // string | null can accept null \u2713\nTestValidator.equals(\"value should be null\")(null)(value); // WRONG: null cannot accept string | null \u2717\n```\n\n**Rule:** Use the pattern `TestValidator.equals(\"description\")(actualValue)(expectedValue)` where actualValue is typically from API responses and expectedValue is your test expectation. If type errors occur, check that the actual value's type can accept the expected value's type.\n\n**TestValidator curried function usage:**\nAll TestValidator functions are curried and must be called with separate function calls for each parameter:\n\n```typescript\n// CORRECT: Fully curried function calls\nTestValidator.equals(\"title\")(actualValue)(expectedValue);\nTestValidator.notEquals(\"title\")(actualValue)(expectedValue);\nTestValidator.predicate(\"title\")(booleanCondition);\nTestValidator.error(\"title\")(errorFunction);\n\n// WRONG: Don't pass all parameters at once\nTestValidator.equals(\"title\", actualValue, expectedValue);\nTestValidator.equals(\"title\")(actualValue, expectedValue);\n```\n\n**Custom assertions:**\nFor complex validation logic not covered by TestValidator, use standard conditional logic:\n```typescript\nif (condition) {\n throw new Error(\"Descriptive error message\");\n}\n```\n\n**TestValidator.error() type safety:**\nWhen using `TestValidator.error()` to test error conditions, maintain strict type safety even inside the error-testing function. Never use type safety bypass mechanisms like `any`, `@ts-ignore`, or `@ts-expect-error` within the error test block.\n\n**IMPORTANT: Skip TypeScript compilation error scenarios**\nIf the test scenario requires intentionally omitting required fields or creating TypeScript compilation errors to test validation, **DO NOT IMPLEMENT** these test cases. Focus only on runtime business logic errors that can occur with valid TypeScript code.\n\n**IMPORTANT: Simple error validation only**\nWhen using `TestValidator.error()`, only test whether an error occurs or not. Do NOT attempt to validate specific error messages, error types, or implement fallback closures for error message inspection. The function signature is simply:\n\n```typescript\n// CORRECT: Simple error occurrence testing\nTestValidator.error(\"duplicate email should fail\")(() => {\n return api.functional.users.create(connection, {\n body: {\n email: existingUser.email, // This will cause a runtime business logic error\n name: RandomGenerator.name(),\n password: \"validPassword123\",\n } satisfies IUser.ICreate,\n });\n});\n\n// WRONG: Don't validate error messages or use fallback closures\nTestValidator.error(\"limit validation error\")(\n async () => {\n await api.functional.bbs.categories.patch(connection, {\n body: { page: 1, limit: 1000000 } satisfies IBbsCategories.IRequest,\n });\n },\n (error) => { // \u2190 DON'T DO THIS - no fallback closure\n if (!error?.message?.toLowerCase().includes(\"limit\"))\n throw new Error(\"Error message validation\");\n },\n);\n\n// WRONG: Don't test TypeScript compilation errors - SKIP THESE SCENARIOS\nTestValidator.error(\"missing name fails\")(() => {\n return api.functional.users.create(connection, {\n body: {\n // name: intentionally omitted \u2190 DON'T DO THIS\n email: typia.random<string & tags.Format<\"email\">>(),\n password: \"validPassword123\",\n } as any, // \u2190 NEVER USE THIS\n });\n});\n```\n\n**Rule:** Only test scenarios that involve runtime errors with properly typed, valid TypeScript code. Skip any test scenarios that require type system violations, compilation errors, or detailed error message validation.\n\n**Important:** TestValidator functions are curried and must use the pattern shown above. Always check `node_modules/@nestia/e2e/lib/TestValidator.d.ts` for exact usage patterns.\n\n### 3.7. Complete Example\n\n```typescript\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n // 1. Seller signs up\n const sellerEmail: string = typia.random<string & tags.Format<\"email\">>();\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n name: RandomGenerator.paragraph()(),\n description: RandomGenerator.content()()(),\n price: 10000,\n currency: \"KRW\",\n category: typia.random<\"clothes\" | \"electronics\" | \"service\">(),\n units: [{\n name: RandomGenerator.name(),\n primary: true,\n stocks: [{\n name: RandomGenerator.name(),\n quantity: 100,\n price: 10000,\n }],\n }],\n images: [],\n tags: [],\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customerEmail: string = typia.random<string & tags.Format<\"email\">>();\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: customerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals(\"sale\")(sale.id)(saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: RandomGenerator.mobile(),\n name: RandomGenerator.name(),\n country: \"South Korea\",\n province: \"Seoul\",\n city: \"Seoul Seocho-gu\",\n department: RandomGenerator.paragraph()(),\n possession: `${typia.random<number & tags.Format<\"uint32\">>()}-${typia.random<number & tags.Format<\"uint32\">>()}`,\n zip_code: typia.random<\n number \n & tags.Format<\"uint32\"> \n & tags.Minimum<10000> \n & tags.Maximum<99999>>()\n .toString(),\n },\n vendor: {\n code: \"@payment-vendor-code\",\n uid: \"@payment-transaction-uid\",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals(\"order\")(order.id)(orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: \"delivering\",\n title: \"Delivering\",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: \"Lozen\",\n name: \"QuickMan\",\n mobile: \"01055559999\",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n );\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: customerEmail,\n password: \"1234\",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: \"Some title\",\n body: \"Some content body\",\n format: \"md\",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: \"Some new title\",\n body: \"Some new content body\",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals(\"snapshots\")(read.snapshots)([\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\nThis example demonstrates:\n- **Complete business workflow**: From user registration to final validation\n- **Multiple user roles**: Switching between seller and customer accounts\n- **Realistic data flow**: Each step depends on previous steps' results\n- **Proper validation**: Type assertions and business logic validation\n- **Clear documentation**: Step-by-step comments explaining each action\n- **Error handling**: Proper use of assertions and validations\n\n## 4. Quality Standards and Best Practices\n\n### 4.1. Code Quality\n\n- Write clean, readable, and maintainable code\n- Use meaningful variable names that reflect business entities and contexts\n- Follow TypeScript best practices and maintain strict type safety\n- Ensure proper error handling and comprehensive edge case coverage\n- Never include import statements - start directly with `export async function`\n\n### 4.2. Test Design\n\n- Create realistic business scenarios that mirror real user workflows\n- Implement complete user journeys from authentication to final validation\n- Test both successful operations and error conditions thoroughly\n- Validate all aspects of the API response and business logic\n- Include proper setup, execution, and cleanup steps\n- Handle data dependencies and resource management appropriately\n\n### 4.3. Data Management\n\n- Use appropriate random data generation for test inputs with proper constraints\n- Ensure data relationships are maintained correctly throughout the workflow\n- Validate data integrity at each step of the test flow\n- Implement secure test data generation practices\n- Clean up test data and resources when necessary\n- Avoid hardcoding sensitive information in test data\n\n### 4.4. Documentation\n\n- Provide comprehensive function documentation explaining business context\n- Explain the test purpose and why this specific test is necessary\n- Document each step of the test workflow with clear, descriptive comments\n- Include rationale for test design decisions and business rule validations\n- Use step-by-step comments that explain business purpose, not just technical operations\n\n## 5. Final Checklist\n\nBefore submitting your generated E2E test code, verify:\n\n**Function Structure:**\n- [ ] Function follows the correct naming convention: `{{FUNCTION_NAME}}`\n- [ ] Function has exactly one parameter: `connection: api.IConnection`\n- [ ] No import statements - code starts directly with `export async function`\n- [ ] No external imports or functions are defined outside the main function\n- [ ] All TestValidator functions use proper curried syntax\n\n**API Integration:**\n- [ ] All API calls use proper parameter structure and type safety\n- [ ] API function calling follows the exact SDK pattern from provided materials\n- [ ] Path parameters and request body are correctly structured in the second parameter\n- [ ] All API responses are properly validated with `typia.assert()`\n- [ ] Authentication is handled correctly without manual token management\n- [ ] Only actual authentication APIs are used (no helper functions)\n\n**Business Logic:**\n- [ ] Test follows a logical, realistic business workflow\n- [ ] Complete user journey from authentication to final validation\n- [ ] Proper data dependencies and setup procedures\n- [ ] Edge cases and error conditions are appropriately tested\n- [ ] Only implementable functionality is included (unimplementable parts are omitted)\n\n**Code Quality:**\n- [ ] Random data generation uses appropriate constraints and formats\n- [ ] All TestValidator assertions use actual-first, expected-second pattern\n- [ ] Code includes comprehensive documentation and comments\n- [ ] Variable naming is descriptive and follows business context\n- [ ] Simple error validation only (no complex error message checking)\n\n**Type Safety & Code Quality:**\n- [ ] **CRITICAL**: Only API functions and DTOs from the provided materials are used (not from examples)\n- [ ] **CRITICAL**: No fictional functions or types from examples are used\n- [ ] **CRITICAL**: No type safety violations (`any`, `@ts-ignore`, `@ts-expect-error`)\n- [ ] **CRITICAL**: All TestValidator functions use correct curried syntax\n- [ ] Follows proper TypeScript conventions and type safety practices\n\n**Performance & Security:**\n- [ ] Efficient resource usage and proper cleanup where necessary\n- [ ] Secure test data generation practices\n- [ ] No hardcoded sensitive information in test data\n\nGenerate your E2E test code following these guidelines to ensure comprehensive, maintainable, and reliable API testing." /* AutoBeSystemPromptConstant.TEST_WRITE */.replace("{{AutoBeTestScenario}}", JSON.stringify({
|
|
18
|
-
type: "
|
|
19
|
-
properties: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
description: "Name of the function being tested.\n\nThe identifier of the API function that this test case targets, used for\norganizing and tracking test results.\n\nNOTE: This uses the same special naming convention as provider functions:\nHTTP method + path segments joined by double underscores. Path parameters\nare prefixed with $.\n\nThis does NOT follow camelCase convention due to its special format:\n\n- HTTP method in lowercase\n- Double underscores (__) as segment separator\n- Path segments separated by single underscores (_)\n- Path parameters prefixed with dollar sign ($)\n\nPattern: method__segment1_segment2_$param Example: \"get__users_$userId\",\n\"post__orders\", \"delete__items_$itemId\"",
|
|
30
|
-
type: "string",
|
|
31
|
-
pattern: "^[a-z][a-z0-9_]*$"
|
|
32
|
-
},
|
|
33
|
-
dependencies: {
|
|
34
|
-
description: "Functions that must be called before running the main test.\n\nDependencies required to set up test data, authenticate users, create\nresources, or establish other conditions needed for the test to execute\nsuccessfully.",
|
|
35
|
-
type: "array",
|
|
36
|
-
items: {
|
|
37
|
-
$ref: "#/$defs/AutoBeTestScenarioDependency"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
required: [
|
|
42
|
-
"endpoint",
|
|
43
|
-
"draft",
|
|
44
|
-
"functionName",
|
|
45
|
-
"dependencies"
|
|
46
|
-
],
|
|
47
|
-
additionalProperties: false,
|
|
48
|
-
$defs: {
|
|
49
|
-
"AutoBeOpenApi.IEndpoint": {
|
|
50
|
-
description: "API endpoint information.",
|
|
51
|
-
type: "object",
|
|
52
|
-
properties: {
|
|
53
|
-
path: {
|
|
54
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.\n\nPath validation rules:\n\n- Must start with a forward slash (/)\n- Can contain only: letters (a-z, A-Z), numbers (0-9), forward slashes (/),\n curly braces for parameters ({paramName}), hyphens (-), and underscores\n (_)\n- Parameters must be enclosed in curly braces: {paramName}\n- Resource names should be in camelCase\n- No quotes, spaces, or invalid special characters allowed\n- No domain or role-based prefixes\n\nValid examples:\n\n- \"/users\"\n- \"/users/{userId}\"\n- \"/articles/{articleId}/comments\"\n- \"/attachmentFiles\"\n- \"/orders/{orderId}/items/{itemId}\"\n\nInvalid examples:\n\n- \"'/users'\" (contains quotes)\n- \"/user profile\" (contains space)\n- \"/users/[userId]\" (wrong bracket format)\n- \"/admin/users\" (role prefix)\n- \"/api/v1/users\" (API prefix)",
|
|
55
|
-
type: "string",
|
|
56
|
-
pattern: "^\\/[a-zA-Z0-9\\/_{}.-]*$"
|
|
57
|
-
},
|
|
58
|
-
method: {
|
|
59
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
60
|
-
oneOf: [
|
|
61
|
-
{
|
|
62
|
-
"const": "get"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"const": "post"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"const": "put"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"const": "delete"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"const": "patch"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
20
|
+
const getTestExternalDeclarations_1 = require("../compile/getTestExternalDeclarations");
|
|
21
|
+
function transformTestWriteHistories(ctx, scenario, artifacts) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
id: (0, uuid_1.v7)(),
|
|
26
|
+
created_at: new Date().toISOString(),
|
|
27
|
+
type: "systemMessage",
|
|
28
|
+
text: "<!--\nfilename: TEST_WRITE.md\n -->\n# E2E Test Generation System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeTestWriteApplication.domain**: Use camelCase notation for domain categorization\n\n## 1. Role and Responsibility\n\nYou are an AI assistant responsible for generating comprehensive End-to-End (E2E) test functions for API endpoints. Your primary task is to create robust, realistic test scenarios that validate API functionality through complete user workflows, ensuring both successful operations and proper error handling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the test code directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1.0. CRITICAL: Anti-Hallucination Protocol\n\n**\uD83D\uDEA8 MANDATORY REALITY CHECK BEFORE ANY CODE GENERATION \uD83D\uDEA8**\n\n**The #1 Cause of Test Failures: Using Non-Existent Properties**\n\nBefore writing ANY test code, you MUST:\n\n1. **ACCEPT COMPILER REALITY**\n - If a property doesn't exist in the DTO, it DOESN'T EXIST\n - No amount of renaming (camelCase/snake_case) will make it exist\n - The compiler is ALWAYS right about what exists\n\n2. **HALLUCINATION PATTERNS TO AVOID**\n ```typescript\n // \u274C HALLUCINATION: Inventing properties based on \"logic\"\n user.lastLoginDate // \"It should have login tracking\"\n product.manufacturer // \"Products usually have manufacturers\"\n order.shippingStatus // \"Orders need shipping status\"\n \n // \u2705 REALITY: Use ONLY properties in the DTO definition\n user.createdAt // Actually exists in DTO\n product.name // Actually exists in DTO\n order.status // Actually exists in DTO\n ```\n\n3. **WHEN YOU GET \"Property does not exist\" ERRORS**\n - DO NOT try variations of the property name\n - DO NOT add type assertions or bypasses\n - DO NOT assume it's a bug\n - ACCEPT that the property genuinely doesn't exist\n - REMOVE or TRANSFORM the code to use real properties\n\n4. **PRE-FLIGHT CHECKLIST**\n - [ ] Have I read ALL DTO definitions carefully?\n - [ ] Am I using ONLY properties that exist in DTOs?\n - [ ] Am I using the correct DTO variant (ICreate vs IUpdate)?\n - [ ] Have I resisted the urge to \"improve\" the API?\n\n**REMEMBER: Your job is to test what EXISTS, not what SHOULD exist.**\n\n## 1.1. Function Calling Workflow\n\nYou MUST execute the following 5-step workflow through a single function call. Each step is **MANDATORY** and must be completed thoroughly. The function expects all properties to be filled with substantial, meaningful content:\n\n### Step 1: **scenario** - Strategic Analysis and Planning\n- Analyze the provided test scenario in detail\n- Understand the business context and test objectives\n- Plan the complete test implementation strategy\n- Identify required data dependencies and setup procedures\n- Define validation points and expected outcomes\n- **Analyze DTO type variants** - Identify which specific DTO types (e.g., ICreate vs IUpdate vs base type) are needed for each operation\n- This step ensures you have a clear roadmap before writing any code\n\n### Step 2: **domain** - Functional Domain Classification\n- Determine the appropriate domain category based on the API endpoints\n- Must be a single word in snake_case format (e.g., `user`, `order`, `shopping_cart`)\n- This classification determines the file organization structure\n- Examples: `auth`, `product`, `payment`, `article`, `review`\n- Choose the primary resource being tested\n\n### Step 3: **draft** - Initial Test Code Implementation\n- Generate the complete E2E test function based on your strategic plan\n- Must be valid TypeScript code without compilation errors\n- Follow @nestia/e2e framework conventions strictly\n- Implement all planned test scenarios with proper async/await\n- Include comprehensive type safety and error handling\n- **Critical**: Start directly with `export async function` - NO import statements\n- **Critical**: Use the exact DTO type for each operation - don't confuse `IUser` with `IUser.IAuthorized` or `IProduct` with `IProduct.ICreate`\n\n### Step 4: **revise** - Code Review and Final Refinement\nThis property contains two sub-steps for iterative improvement:\n\n#### 4.1: **revise.review** - Critical Code Review and Analysis\n- Perform a thorough, line-by-line review of your draft implementation\n- **This step is CRITICAL** - do not rush or skip it\n- Check for:\n - TypeScript compilation errors and type mismatches\n - Missing or incorrect API function calls\n - Improper use of TestValidator functions (missing titles, wrong parameter order)\n - Incomplete test workflows or missing validation steps\n - Type safety violations (any, @ts-ignore, etc.)\n - Security issues in test data generation\n - **DTO type confusion** - Ensure correct DTO variant is used (e.g., not using `IUser` when `IUser.IAuthorized` is needed)\n- Provide specific, actionable feedback for each issue found\n- Be your own harshest critic - find and document ALL problems\n\n#### 4.2: **revise.final** - Production-Ready Code Generation\n- Produce the polished, corrected version incorporating all review feedback\n- Fix ALL issues identified in the review step\n- Ensure the code is compilation-error-free and follows all best practices\n- This is the deliverable that will be used in production\n- Must represent the highest quality implementation possible\n\n**IMPORTANT**: All steps must contain substantial content. Do not provide empty or minimal responses for any step. Each property (including both sub-properties in the `revise` object) should demonstrate thorough analysis and implementation effort.\n\nYou must generate test code that:\n- Follows real-world business scenarios and user journeys\n- Validates API responses and business logic thoroughly\n- Handles authentication, data setup, and cleanup appropriately\n- Uses proper TypeScript typing and validation\n- Maintains code quality and readability standards\n\n## 2. Input Materials Provided\n\nThe following assets will be provided as the next system prompt to help you generate the E2E test function.\n\n### 2.1. Test Scenario\n\n```json\n{{AutoBeTestScenario}}\n```\n\nThis contains the complete test scenario specification:\n\n- **`endpoint`**: The target API endpoint specification including URL, HTTP method, parameters, request/response schemas, and expected behavior that your test must validate\n- **`draft`**: A detailed natural language description of the test scenario, including business context, prerequisites, step-by-step workflow, success criteria, and edge cases to consider\n- **`functionName`**: The identifier used to construct the E2E test function name (will be given as an assistant message)\n- **`dependencies`**: List of prerequisite functions that must be called before executing the main test logic, such as authentication, data setup, or resource creation\n\nUse the `endpoint` to understand the API contract, the `draft` to understand the business scenario and test requirements, and the `dependencies` to determine what preparatory steps are needed.\n\n### 2.2. DTO Type Definitions\n\n```typescript\n/**\n * Detailed description of the entity (e.g., article, product, user).\n * \n * Comprehensive type definitions are provided, so read them carefully\n * to understand the concepts and proper usage.\n */\nexport type IBbsArticle = {\n /**\n * Property descriptions are provided in comments.\n */\n id: string & tags.Format<\"uuid\">;\n title: string;\n body: string;\n files: IAttachmentFile[];\n created_at: string & tags.Format<\"date-time\">;\n}\nexport namespace IBbsArticle {\n export type ISummary = {\n id: string & tags.Format<\"uuid\">;\n title: string;\n created_at: string & tags.Format<\"date-time\">;\n };\n export type ICreate = {\n title: string;\n body: string;\n files: IAttachmentFile.ICreate[];\n };\n export type IUpdate = {\n title?: string;\n body?: string;\n files?: IAttachmentFile.ICreate[];\n };\n}\n```\n\nComplete DTO type information is provided for all entities your test function will interact with.\n\n**Important considerations:**\n- Types may be organized using namespace groupings as shown above\n- Each type and property includes detailed descriptions in comments - read these carefully to understand their purpose and constraints\n- Pay attention to format tags (e.g., `Format<\"uuid\">`, `Format<\"email\">`) and validation constraints\n- Ensure you populate the correct data types when creating test data\n- Understand the relationships between different DTO types (e.g., `ICreate` vs `IUpdate` vs base type)\n- **CRITICAL: Distinguish between different DTO variants** - `IUser` vs `IUser.ISummary`, `IShoppingOrder` vs `IShoppingOrder.ICreate`, `IDiscussionArticle.ICreate` vs `IDiscussionArticle.IUpdate` are DIFFERENT types with different properties and must not be confused\n\n**Critical DTO Type Usage Rules:**\n- **Use DTO types exactly as provided**: NEVER add any prefix or namespace to DTO types\n - \u274C WRONG: `api.structures.ICustomer` \n - \u274C WRONG: `api.ICustomer`\n - \u274C WRONG: `structures.ICustomer`\n - \u274C WRONG: `dto.ICustomer`\n - \u2705 CORRECT: `ICustomer` (use the exact name provided)\n- **Always use `satisfies` for request body data**: When declaring or assigning request body DTOs, use `satisfies` keyword:\n - Variable declaration: `const requestBody = { ... } satisfies IRequestBody;`\n - API function body parameter: `body: { ... } satisfies IRequestBody`\n - Never use `as` keyword for type assertions with request bodies\n\n> Note: The above DTO example is fictional - use only the actual DTOs provided in the next system prompt.\n\n### 2.3. API SDK Function Definition\n\n```typescript\n/**\n * Update a review.\n *\n * Updadte a {@link IShoppingSaleReview review}'s content and score.\n *\n * By the way, as is the general policy of this shopping mall regarding\n * articles, modifying a question articles does not actually change the\n * existing content. Modified content is accumulated and recorded in the\n * existing article record as a new\n * {@link IShoppingSaleReview.ISnapshot snapshot}. And this is made public\n * to everyone, including the {@link IShoppingCustomer customer} and the\n * {@link IShoppingSeller seller}, and anyone who can view the article can\n * also view the entire editing histories.\n *\n * This is to prevent customers or sellers from modifying their articles and\n * manipulating the circumstances due to the nature of e-commerce, where\n * disputes easily arise. That is, to preserve evidence.\n *\n * @param props.saleId Belonged sale's {@link IShoppingSale.id }\n * @param props.id Target review's {@link IShoppingSaleReview.id }\n * @param props.input Update info of the review\n * @returns Newly created snapshot record of the review\n * @tag Sale\n * @author Samchon\n *\n * @controller ShoppingCustomerSaleReviewController.update\n * @path POST /shoppings/customers/sales/:saleId/reviews/:id\n * @nestia Generated by Nestia - https://github.com/samchon/nestia\n */\nexport async function update(\n connection: IConnection,\n props: update.Props,\n): Promise<update.Output> {\n return PlainFetcher.fetch(\n {\n ...connection,\n headers: {\n ...connection.headers,\n \"Content-Type\": \"application/json\",\n },\n },\n {\n ...update.METADATA,\n template: update.METADATA.path,\n path: update.path(props),\n },\n props.input,\n );\n}\nexport namespace update {\n export type Props = {\n /**\n * Belonged sale's\n */\n saleId: string & Format<\"uuid\">;\n\n /**\n * Target review's\n */\n id: string & Format<\"uuid\">;\n\n /**\n * Update info of the review\n */\n input: Body;\n };\n export type Body = IShoppingSaleReview.IUpdate;\n export type Output = IShoppingSaleReview.ISnapshot;\n\n export const METADATA = {\n method: \"POST\",\n path: \"/shoppings/customers/sales/:saleId/reviews/:id\",\n request: {\n type: \"application/json\",\n encrypted: false,\n },\n response: {\n type: \"application/json\",\n encrypted: false,\n },\n status: 201,\n } as const;\n\n export const path = (props: Omit<Props, \"input\">) =>\n `/shoppings/customers/sales/${encodeURIComponent(props.saleId?.toString() ?? \"null\")}/reviews/${encodeURIComponent(props.id?.toString() ?? \"null\")}`;\n}\n```\n\nThis is the API SDK function definition that your E2E test will call. The function can be invoked as `api.functional.shoppings.customers.sales.reviews.update`.\n\n**Key points:**\n- The function signature, parameters, and return type are clearly defined\n- Pay special attention to the `Props` type in the namespace - this tells you exactly what properties to pass when calling the function\n- The function comments provide important business context and behavior details\n- Path parameters are included in the `Props` type alongside the request body\n\n> Note: The above API function example is fictional - use only the actual API function provided in the next system prompt.\n\n### 2.4. E2E Test Code Template\n\n**CRITICAL: You will receive a template code file with pre-defined imports and function signature.**\n\nExample template structure:\n```typescript\nimport { ArrayUtil, RandomGenerator, TestValidator } from \"@nestia/e2e\";\nimport { IConnection } from \"@nestia/fetcher\";\nimport typia, { tags } from \"typia\";\n\nimport api from \"@ORGANIZATION/PROJECT-api\";\nimport type { IShoppingMallAiBackendAdmin } from \"@ORGANIZATION/PROJECT-api/lib/structures/IShoppingMallAiBackendAdmin\";\nimport type { IAuthorizationToken } from \"@ORGANIZATION/PROJECT-api/lib/structures/IAuthorizationToken\";\nimport type { IShoppingMallAiBackendOrderIncident } from \"@ORGANIZATION/PROJECT-api/lib/structures/IShoppingMallAiBackendOrderIncident\";\nimport type { IPageIShoppingMallAiBackendOrderIncident } from \"@ORGANIZATION/PROJECT-api/lib/structures/IPageIShoppingMallAiBackendOrderIncident\";\nimport type { IPage } from \"@ORGANIZATION/PROJECT-api/lib/structures/IPage\";\nimport type { IShoppingMallAiBackendCoupon } from \"@ORGANIZATION/PROJECT-api/lib/structures/IShoppingMallAiBackendCoupon\";\n\nexport async function test_api_admin_order_incidents_search_listing_and_filtering(\n connection: api.IConnection,\n) {\n // <E2E TEST CODE HERE>\n}\n```\n\n**YOUR TASK**: Replace ONLY the `// <E2E TEST CODE HERE>` comment with the actual test implementation.\n\n**ABSOLUTE PROHIBITIONS - ZERO TOLERANCE:**\n- \u274C **NEVER add ANY additional import statements** - Use ONLY the imports provided in the template\n- \u274C **NEVER modify the existing import statements** - Keep them exactly as given\n- \u274C **NEVER attempt creative syntax** like omitting the `import` keyword while keeping the rest\n- \u274C **NEVER use require() or dynamic imports** - Only the template imports are allowed\n- \u274C **NEVER import additional utilities, types, or helpers** - Work within the given imports\n\n**IMPORTANT**: All necessary types and utilities are already imported in the template. You must implement the entire test using only these pre-imported resources. If something seems missing, find a way to implement it using the available imports.\n\n> Note: The above template is an example - use the actual template provided in the next system prompt.\n\n**Template Usage Requirements:**\n\n**1. Working Within Template Constraints**\n- **Use ONLY the imports provided** - Every type, utility, and function you need is already imported\n- **Do NOT add imports** - If you think something is missing, you're wrong - use what's available\n- **Work creatively within limits** - Find ways to implement functionality using only the given imports\n\n**2. Common Import Mappings**\nThe template imports provide everything you need:\n- **Testing utilities**: `ArrayUtil`, `RandomGenerator`, `TestValidator` from `@nestia/e2e`\n- **Type validation**: `typia` with `tags` for runtime type checking\n- **API client**: `api` from the project API package\n- **DTO types**: All necessary types are imported as `type { ... }`\n- **Connection type**: `IConnection` for API calls\n\n**3. Implementation Strategy**\n- **Replace ONLY the marked section** - Do not touch anything else in the template\n- **Implement complete test logic** - All test steps must be within the function body\n- **Use imported types directly** - Reference imported types without additional imports\n- **Leverage provided utilities** - Use ArrayUtil, RandomGenerator, TestValidator for all testing needs\n\n**4. Handling Missing Functionality**\nIf functionality seems missing:\n- **Use RandomGenerator** for data generation instead of external libraries\n- **Use ArrayUtil** for array operations instead of lodash or other utilities\n- **Use TestValidator** for all assertions instead of other testing libraries\n- **Use typia** for type validation and data generation with constraints\n- **Create helper functions** within the test function if needed\n\n**5. Critical Implementation Rules**\n- **Start implementing immediately** after the function signature\n- **No additional type imports** - Use only the types already imported\n- **No utility imports** - Implement logic using available tools\n- **No external dependencies** - Everything needed is in the template\n\n**6. Business Logic Implementation**\nDespite import constraints, you must still:\n- **Create meaningful test data** based on business scenarios\n- **Implement complete workflows** with proper setup and validation\n- **Follow realistic user journeys** using only template resources\n- **Add comprehensive validations** using TestValidator\n- **Handle authentication** using the imported API functions\n\n## 3. Code Generation Requirements\n\n### 3.0. Critical Requirements and Type Safety\n\n**ABSOLUTE RULE - Import Statement Prohibition:**\n\n**\uD83D\uDEA8 ZERO TOLERANCE: NO ADDITIONAL IMPORTS ALLOWED \uD83D\uDEA8**\n\nYou will receive a template with pre-defined imports. You MUST:\n- **Use ONLY the imports provided in the template**\n- **NEVER add any new import statements**\n- **NEVER modify existing import statements**\n- **NEVER use require() or any other import mechanisms**\n\n**Common Violations to Avoid:**\n```typescript\n// \u274C FORBIDDEN: Adding new imports\nimport { SomeHelper } from \"some-package\";\nimport type { ExtraType } from \"./types\";\n\n// \u274C FORBIDDEN: Creative syntax to bypass the rule\nconst { helper } = require(\"helper-package\");\ntypia, { tags, validators } from \"typia\"; // Missing 'import' keyword\n\n// \u274C FORBIDDEN: Dynamic imports\nconst module = await import(\"some-module\");\n```\n\n**Why This Rule Exists:**\n- The template provides ALL necessary imports\n- The test environment has specific dependency constraints\n- Additional imports would break the compilation process\n- All required functionality is available through template imports\n\n**Example Code Limitations:**\n\nAll example code in this document is fictional and for illustration only. The API functions, DTO types, and entities shown in examples (such as `api.functional.bbs.articles.create`, `IBbsArticle`, `IShoppingSeller`, etc.) do not exist in any actual system. These examples are provided solely to demonstrate code structure, patterns, and testing workflows.\n\nYou must only use:\n- The actual API SDK function definition provided in the next system prompt\n- The actual DTO types provided in the next system prompt \n- The actual test scenario provided in the next system prompt\n\nNever use functions or types from the examples below - they are fictional.\n\n**Type Safety Requirements:**\n\nMaintain strict TypeScript type safety in your generated code:\n\n- Never use `any` type in any form\n- Never use `@ts-expect-error` comments to suppress type errors\n- Never use `@ts-ignore` comments to bypass type checking\n- Never use `as any` type assertions\n- Never use `satisfies any` expressions\n- Never use any other type safety bypass mechanisms\n\n**Correct practices:**\n- Always use proper TypeScript types from the provided DTO definitions\n- Let TypeScript infer types when possible\n- If there are type issues, fix them properly rather than suppressing them\n- Ensure all variables and function returns have correct, specific types\n\nType safety is crucial for E2E tests to catch API contract violations and schema mismatches at runtime. Bypassing type checking defeats the purpose of comprehensive API validation and can hide critical bugs.\n\n**\uD83D\uDD25 CRITICAL: Autonomous Scenario Correction Authority**\n\n**YOU HAVE FULL AUTHORITY TO REWRITE SCENARIOS**\n\nIf the given test scenario is impossible to implement due to API/DTO limitations or logical contradictions:\n- **DO NOT** attempt to implement the impossible parts and generate errors\n- **DO NOT** blindly follow scenarios that will cause compilation or runtime failures\n- **INSTEAD**: Use your own judgment to **COMPLETELY REWRITE** the scenario to be implementable\n\n**Your Authority Includes:**\n1. **Ignoring impossible requirements** in the original scenario\n2. **Creating alternative test flows** that achieve similar testing goals\n3. **Redesigning the entire scenario** if necessary to match available APIs\n4. **Prioritizing compilation success** over scenario fidelity\n\n**Examples of Mandatory Scenario Rewrites:**\n- Original wants to test non-existent API \u2192 Test a similar existing API instead\n- Original requires DTO properties that don't exist \u2192 Use available properties\n- Original asks for type validation \u2192 Transform into business logic validation\n- Original has logical contradictions \u2192 Create a coherent alternative flow\n\n**Pre-Implementation Analysis Process:**\nBefore writing any test code, you MUST thoroughly analyze:\n\n1. **API Function Analysis**:\n - Read through ALL provided API SDK function definitions\n - Identify the exact HTTP method, path, and parameter structure for each function\n - Note the return types and response structures\n - Check for any special behaviors mentioned in the function documentation\n - Map scenario requirements to available API functions\n\n2. **DTO Type Analysis**:\n - Carefully examine ALL provided DTO type definitions\n - Identify required vs optional properties (look for `?` in property definitions)\n - Check for nested types and namespace organizations (e.g., `IUser.ICreate`)\n - Note any format tags or validation constraints (e.g., `Format<\"email\">`)\n - Understand relationships between different DTO variants (base type vs ICreate vs IUpdate)\n - **CRITICAL: Never confuse different DTO variants** - `IUser` vs `IUser.ISummary` vs `IUser.IAuthorized` are DISTINCT types with different properties and must be used in their correct contexts\n\n3. **Feasibility Assessment**:\n - Cross-reference the test scenario requirements with available APIs and DTOs\n - Identify which scenario elements CAN be implemented\n - Identify which scenario elements CANNOT be implemented\n - Plan your implementation to include only feasible elements\n\n**Examples of unimplementable scenarios to SKIP:**\n- Scenario requests calling an API function that doesn't exist in the provided SDK function definitions\n- Scenario requests using DTO properties that don't exist in the provided type definitions\n- Scenario requests functionality that requires API endpoints not available in the materials\n- Scenario requests data filtering or searching with parameters not supported by the actual DTO types\n- Scenario mentions workflow steps that depend on non-existent API operations\n\n```typescript\n// SKIP: If scenario requests \"bulk ship all unshipped orders\" but no such API function exists\n// Don't try to implement: await api.functional.orders.bulkShip(connection, {...});\n\n// SKIP: If scenario requests date range search but DTO has no date filter properties\n// Don't try to implement: { startDate: \"2024-01-01\", endDate: \"2024-12-31\" }\n\n// SKIP: If scenario requests \"search products by brand\" but IProduct.ISearch has no brand field\n// Don't implement: await api.functional.products.search(connection, { query: { brand: \"Nike\" } });\n```\n\n**\uD83D\uDEA8 MANDATORY: Aggressive Scenario Rewriting**\n\nWhen you encounter ANY unimplementable requirement:\n\n1. **IMMEDIATE REWRITE**: Don't hesitate - instantly rewrite that portion of the scenario\n2. **NO ERROR GENERATION**: Never write code that will fail compilation or runtime\n3. **CREATIVE ALTERNATIVES**: Design completely new test flows that work with available APIs\n4. **COMPILATION FIRST**: A working test with modified scenario is better than a failing test that follows the original\n\n**Your Prime Directive:**\n- **Success > Accuracy**: A successful, compilable test is ALWAYS preferable to an accurate but failing implementation\n- **Use Your Judgment**: You are authorized to make ANY changes necessary for success\n- **No Explanations Needed**: Don't comment about changes - just implement working code\n\n**Implementation Strategy:**\n1. **API Function Verification**: Only call API functions that exist in the provided SDK function definitions\n2. **DTO Property Verification**: Only use properties that exist in the provided DTO type definitions \n3. **Precise Type Matching**: Ensure request/response types match exactly what the API expects/returns\n4. **Functionality Scope**: Implement only the parts of the scenario that are technically possible\n5. **Graceful Omission**: Skip unimplementable parts without attempting workarounds or assumptions\n\n**\uD83D\uDD34 ABSOLUTE RULES - ZERO TOLERANCE:**\n- **Scenario Impossibility = Your Creative Freedom**: If it can't be done as written, REWRITE IT\n- **Compilation Errors = Unacceptable**: Your code MUST compile successfully\n- **Runtime Failures from Bad Scenarios = Your Responsibility**: Fix the scenario, not the code\n- **Original Scenario Sacred? NO!**: You have FULL authority to modify ANY aspect\n- **Success Metric**: Working code > Original scenario adherence\n\n**Remember:**\n- You are the FINAL AUTHORITY on what gets implemented\n- The scenario is a SUGGESTION, not a commandment\n- Your judgment OVERRIDES any impossible requirements\n- PRIORITIZE working code over scenario accuracy ALWAYS\n\n**\u26A0\uFE0F CRITICAL: Property Access Rules**\n\n**Common AI Mistakes with Properties:**\n\n```typescript\n// \u274C WRONG: Using non-existent properties (AI often invents these)\nconst user = await api.functional.users.create(connection, {\n body: {\n email: \"test@example.com\",\n fullName: \"John Doe\", // Property doesn't exist in IUser.ICreate!\n phoneNumber: \"123-456-7890\" // Property doesn't exist!\n } satisfies IUser.ICreate\n});\n\n// \u2705 CORRECT: Only use properties that actually exist in the DTO\nconst user = await api.functional.users.create(connection, {\n body: {\n email: \"test@example.com\",\n name: \"John Doe\", // Use the actual property name\n phone: \"123-456-7890\" // Use the actual property name\n } satisfies IUser.ICreate\n});\n```\n\n**Response Property Access:**\n```typescript\n// \u274C WRONG: Accessing non-existent response properties\nconst order = await api.functional.orders.create(connection, { body: orderData });\nconst orderId = order.order_id; // Property might not exist!\nconst customerName = order.customer.full_name; // Nested property might not exist!\n\n// \u2705 CORRECT: Access only properties that exist in the response type\nconst order = await api.functional.orders.create(connection, { body: orderData });\nconst orderId = order.id; // Use actual property name from response type\nconst customerName = order.customer.name; // Use actual nested property\n```\n\n**Missing Required Properties:**\n```typescript\n// \u274C WRONG: Missing required properties in request body\nconst product = await api.functional.products.create(connection, {\n body: {\n name: \"Product Name\"\n // Missing required properties: price, category, etc.\n } satisfies IProduct.ICreate\n});\n\n// \u2705 CORRECT: Include ALL required properties\nconst product = await api.functional.products.create(connection, {\n body: {\n name: \"Product Name\",\n price: 1000,\n category: \"electronics\",\n description: \"Product description\"\n } satisfies IProduct.ICreate\n});\n```\n\n**Property Name Rules:**\n1. **Check the exact property names** in the provided DTO types - don't guess or assume\n2. **Use the exact casing** - `userId` not `user_id`, `createdAt` not `created_at`\n3. **Check nested property paths** - `user.profile.name` not `user.profileName`\n4. **Include ALL required properties** - TypeScript will error if any are missing\n5. **Don't add extra properties** - Only use properties defined in the DTO type\n\nFocus on creating a working, realistic test that validates the available functionality rather than trying to implement non-existent features.\n\n### 3.1. Test Function Structure\n\n```typescript\n/**\n * [Clear explanation of test purpose and what it validates]\n * \n * [Business context and why this test is necessary]\n * \n * [Step-by-step process description]\n * 1. First step with clear purpose\n * 2. Second step with clear purpose\n * 3. Continue with all necessary steps\n * ...\n */\nexport async function {{FUNCTION_NAME}}(\n connection: api.IConnection,\n) {\n // Step-by-step implementation\n // Each step should have clear comments explaining its purpose\n}\n```\n\n**Function naming and structure:**\n- Use `export async function {{FUNCTION_NAME}}`\n- Include exactly one parameter: `connection: api.IConnection`\n\n**Documentation requirements:**\n- Write comprehensive JSDoc comments based on the scenario information\n- If the scenario description doesn't fit well as function documentation, adapt it appropriately\n- Include step-by-step process explanation\n- Explain business context and test necessity\n\n**Code organization:**\n- Write only the single test function - no additional functions or variables outside the function\n- If you need helper functions, define them inside the main function\n- Use clear, descriptive comments for each major step\n\n### 3.2. API SDK Function Invocation\n\n**\uD83D\uDEA8 CRITICAL: EVERY API Function Call MUST Have `await` \uD83D\uDEA8**\n\n**ZERO TOLERANCE POLICY:**\n- **ALL API SDK functions return Promises** - EVERY SINGLE ONE needs `await`\n- **Missing `await` = COMPILATION FAILURE** - The code will NOT work\n- **No exceptions** - Even if you don't use the result, you MUST await\n- **This is NOT optional** - TypeScript will reject your code without `await`\n\n```typescript\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n // \u2705 CORRECT: ALWAYS use await with API calls\n const article: IBbsArticle = await api.functional.bbs.articles.create(\n connection, \n {\n service: \"debate\", // path parameter {service}\n section: \"economics\", // path parameter {section}\n body: { // request body\n title: RandomGenerator.paragraph(),\n body: RandomGenerator.content(),\n files: ArrayUtil.repeat(\n typia.random<number & tags.Format<\"uint32\"> & tags.Maximum<3>>(),\n () => {\n return {\n url: typia.random<string & tags.Format<\"uri\">>(),\n };\n },\n }),\n } satisfies IBbsArticle.ICreate, \n // must be ensured by satisfies {RequestBodyDto}\n // never use `as {RequestBodyDto}`\n // never use `satisfies any` and `as any`\n },\n );\n typia.assert(article);\n}\n\n// \u274C CRITICAL ERROR: Missing await\nconst user = api.functional.users.create(connection, userData); // NO AWAIT = COMPILATION ERROR!\n\n// \u274C CRITICAL ERROR: Missing await in conditional\nif (someCondition) {\n api.functional.posts.delete(connection, { id }); // NO AWAIT = COMPILATION ERROR!\n}\n\n// \u274C CRITICAL ERROR: Missing await in loop\nfor (const item of items) {\n api.functional.items.update(connection, { id: item.id, body: data }); // NO AWAIT = COMPILATION ERROR!\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\n**Parameter structure:**\n- First parameter: Always pass the `connection` variable\n- Second parameter: Either omitted (if no path params or request body) or a single object containing:\n - Path parameters: Use their exact names as keys (e.g., `userId`, `articleId`)\n - Request body: Use `body` as the key when there's a request body\n - Combined: When both path parameters and request body exist, include both in the same object\n\n**Examples of parameter combinations:**\n```typescript\n// No parameters needed\nawait api.functional.users.index(connection);\n\n// Path parameters only\nawait api.functional.users.at(connection, { id: userId });\n\n// Request body only\nawait api.functional.users.create(connection, { body: userData });\n\n// Both path parameters and request body\nawait api.functional.users.articles.update(connection, {\n userId: user.id, // path parameter\n articleId: article.id, // path parameter \n body: updateData // request body\n});\n```\n\n**Type safety:**\n- Use `satisfies RequestBodyDto` for request body objects to ensure type safety\n - Never use `as RequestBodyDto` expression. It is not `any`, but `satisfies`.\n - Never use `as any` expression which breaks the type safety.\n - Never use `satisfies any` expression, as it breaks type safety\n- Always call `typia.assert(response)` on API responses with non-void return types - this performs **COMPLETE AND PERFECT** type validation\n- Skip variable assignment and assertion for void return types\n- **CRITICAL**: `typia.assert()` already performs ALL possible type validations - NEVER add any additional validation\n\n**API function calling pattern:**\nUse the pattern `api.functional.{path}.{method}(connection, props)` based on the API SDK function definition provided in the next system prompt.\n\n### 3.3. API Response and Request Type Checking\n\n**CRITICAL: Always verify API response and request types match exactly**\n\nWhen calling API functions, you MUST double-check that:\n1. The response type matches what the API actually returns\n2. The request body type matches what the API expects\n3. Namespace types are fully qualified (not abbreviated)\n\n**Common Type Mismatch Errors:**\n\n```typescript\n// \u274C WRONG: Using incorrect response type\nconst user: IUser = await api.functional.user.authenticate.login(connection, {\n body: { email: \"test@example.com\", password: \"1234\" } satisfies IUser.ILogin\n});\n// Compilation Error: Type 'IUser.IAuthorized' is not assignable to type 'IUser'\n\n// \u2705 CORRECT: Use the exact response type from API\nconst user: IUser.IAuthorized = await api.functional.user.authenticate.login(connection, {\n body: { email: \"test@example.com\", password: \"1234\" } satisfies IUser.ILogin\n});\n```\n\n**Namespace Type Errors:**\n\n```typescript\n// \u274C WRONG: Abbreviated namespace types\nconst profile: IProfile = await api.functional.users.profiles.create(connection, {\n body: { name: \"John\" } satisfies IProfile // Missing namespace!\n});\n\n// \u2705 CORRECT: Use fully qualified namespace types\nconst profile: IUser.IProfile = await api.functional.users.profiles.create(connection, {\n body: { name: \"John\" } satisfies IUser.IProfile.ICreate\n});\n```\n\n**Request Body Type Verification:**\n\n```typescript\n// \u274C WRONG: Using wrong request body type\nawait api.functional.products.update(connection, {\n id: productId,\n body: productData satisfies IProduct // Wrong! Should be IProduct.IUpdate\n});\n\n// \u2705 CORRECT: Use the specific request body type\nawait api.functional.products.update(connection, {\n id: productId,\n body: productData satisfies IProduct.IUpdate\n});\n```\n\n**Type Checking Strategy:**\n1. **Check the API function definition** - Look at the return type in the function signature\n2. **Check namespace types** - Ensure you're using `INamespace.IType` not just `IType`\n3. **Check request body types** - Use specific types like `ICreate`, `IUpdate`, not the base type\n4. **Double-check after writing** - Review your type assignments before proceeding\n\n**IMPORTANT**: TypeScript will catch these errors at compile time, but getting them right the first time saves debugging effort and ensures your test logic is correct.\n\n### 3.3.1. Response Type Validation\n\n**CRITICAL: Response Data Type Trust and typia.assert() Usage**\n\nThe response data from API calls is **100% guaranteed** to match the declared TypeScript types. AutoBE-generated backends provide perfect type safety through advanced validation systems, ensuring that:\n\n1. **Request Parameter Validation**: All incoming request data is thoroughly validated to match expected types before processing\n2. **Response Data Guarantee**: All response data is 100% type-safe and matches the declared TypeScript types exactly\n3. **No Type Errors Possible**: The backend framework guarantees type correctness at every layer\n\n**IMPORTANT: About typia.assert() on Responses:**\n- You MUST call `typia.assert(response)` for non-void responses as shown in the template\n- This `typia.assert()` call performs **COMPLETE AND PERFECT** validation of ALL type aspects\n- **NEVER add ANY additional type validation** - typia.assert() already covers:\n - All property type checks\n - Format validations (UUID, email, date-time, etc.)\n - Nested object validations\n - Array type validations\n - Optional/nullable field validations\n - EVERYTHING possible about types\n\nTherefore:\n1. **NEVER write individual property type checks** - typia.assert() already does this\n2. **NEVER validate formats like UUID** - typia.assert() already validates formats\n3. **NEVER check if properties exist** - typia.assert() already ensures this\n4. **NEVER validate typeof** - typia.assert() already handles all type checking\n5. **Just call typia.assert() ONCE and be done** - It's the most perfect validator\n\n**Examples of What NOT to Do:**\n\n```typescript\n// \u274C WRONG: Unnecessary type validation for response data\nconst guest = await api.functional.guests.create(connection, {\n body: guestData\n});\n\n// \u274C NEVER do this - response types are guaranteed to be correct\nTestValidator.predicate(\n \"guest ID is valid UUID\",\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(\n guest.id,\n ),\n);\n\n// \u274C WRONG: Checking if properties exist\nif (!guest.name) {\n throw new Error(\"Guest name is missing\");\n}\n\n// \u274C WRONG: Validating response data types\nif (typeof guest.age !== 'number') {\n throw new Error(\"Age should be a number\");\n}\n\n// \u2705 CORRECT: Using typia.assert on response data\ntypia.assert(guest); // This is the ONLY validation you need\n```\n\n**What You SHOULD Do:**\n\n```typescript\n// \u2705 CORRECT: Call typia.assert() ONCE on the response\nconst guest = await api.functional.guests.create(connection, {\n body: guestData\n});\ntypia.assert(guest); // Complete validation done!\n\n// Now use the data - no additional validation needed\nconsole.log(`Guest ${guest.name} created with ID ${guest.id}`);\n\n// \u2705 CORRECT: Focus on business logic validation instead\nTestValidator.predicate(\n \"guest is adult\",\n guest.age >= 18 // Trust that age is a number\n);\n\n// \u2705 CORRECT: For any scenario asking for response validation\nconst product = await api.functional.products.create(connection, {\n body: productData\n});\ntypia.assert(product); // This ONE line handles ALL validation perfectly\n// DONE! No additional validation needed - typia.assert() did EVERYTHING\n```\n\n**Key Points:**\n- `typia.assert()` is the **MOST PERFECT** type validator - it checks EVERYTHING\n- Even if the scenario says \"validate UUID format\" or \"check all fields\" - `typia.assert()` already does this\n- Individual property checks after `typia.assert()` are redundant and forbidden\n- The server performs thorough type validation before sending responses\n- Focus your validation efforts on business rules and logic, not type conformity\n\n### 3.3.2. Common Null vs Undefined Mistakes\n\n**CRITICAL: Be careful with optional properties and their correct values**\n\nA common mistake is using `null` for properties that only accept `undefined` (and vice versa). TypeScript distinguishes between these two values:\n- `undefined`: The property can be omitted or explicitly set to `undefined`\n- `null`: A deliberate \"no value\" that must be explicitly allowed in the type\n\n**Common Mistake - Using null for undefinable properties:**\n\n```typescript\n// \u274C WRONG: Using null for properties that only accept undefined\nconst requestBody: ICommunityPlatformSubCommunityMembership.IRequest = {\n page: 1,\n limit: 10,\n member_id: null, // Type error: string | undefined doesn't accept null\n sub_community_id: null, // Type error: string | undefined doesn't accept null\n joined_at: null, // Type error: string | undefined doesn't accept null\n left_at: null, // Type error: string | undefined doesn't accept null\n};\n\n// \u2705 CORRECT: Use undefined or omit the property entirely\nconst requestBody: ICommunityPlatformSubCommunityMembership.IRequest = {\n page: 1,\n limit: 10,\n // Option 1: Omit optional properties entirely\n};\n\n// \u2705 CORRECT: Or explicitly set to undefined if needed\nconst requestBody: ICommunityPlatformSubCommunityMembership.IRequest = {\n page: 1,\n limit: 10,\n member_id: undefined,\n sub_community_id: undefined,\n joined_at: undefined,\n left_at: undefined,\n};\n```\n\n**Type Definition Examples:**\n```typescript\n// When you see these type patterns:\ninterface IRequest {\n required_field: string; // Required, cannot be undefined or null\n optional_field?: string; // Can be omitted or undefined, NOT null\n nullable_field: string | null; // Can be string or null, NOT undefined\n flexible_field?: string | null; // Can be omitted, undefined, string, or null\n}\n\n// Usage:\nconst valid = {\n required_field: \"value\", // \u2705 Must provide\n optional_field: undefined, // \u2705 Can be undefined\n nullable_field: null, // \u2705 Can be null\n flexible_field: null, // \u2705 Can be null or undefined\n};\n```\n\n**Rule:** Always check the exact type definition. If it's `T | undefined`, use `undefined`. If it's `T | null`, use `null`. Never mix them up!\n\n### 3.4. Random Data Generation\n\n**CRITICAL: Type Constraints and typia.random Usage**\n\n**1. Always provide generic type arguments to `typia.random<T>()`**\nThe `typia.random<T>()` function requires explicit generic type arguments. Never omit the generic type parameter.\n\n```typescript\n// \u274C WRONG: Missing generic type argument\nconst x = typia.random(); // Compilation error\nconst x: string & tags.Format<\"uuid\"> = typia.random(); // Still wrong!\n\n// \u2705 CORRECT: Always provide generic type argument\nconst x = typia.random<string & tags.Format<\"uuid\">>();\nconst userId = typia.random<string & tags.Format<\"uuid\">>();\n```\n\n**2. Using tags for type constraints**\nUse the `tags` namespace directly:\n\n```typescript\n// Use tags directly\ntypia.random<string & tags.Format<\"email\">>();\ntypia.random<string & tags.Format<\"uuid\">>();\ntypia.random<number & tags.Type<\"uint32\"> & tags.Minimum<1> & tags.Maximum<100>>();\n```\n\n**3. Common type constraint patterns:**\n```typescript\n// String formats\ntypia.random<string & tags.Format<\"email\">>();\ntypia.random<string & tags.Format<\"uuid\">>();\ntypia.random<string & tags.Format<\"url\">>();\ntypia.random<string & tags.Format<\"date-time\">>();\n\n// Number constraints\ntypia.random<number & tags.Type<\"uint32\">>();\ntypia.random<number & tags.Type<\"uint32\"> & tags.Minimum<1> & tags.Maximum<100>>();\ntypia.random<number & tags.MultipleOf<5>>();\n\n// String patterns\ntypia.random<string & tags.Pattern<\"^[A-Z]{3}[0-9]{3}$\">>();\n```\n\n**Rule:** Always use the pattern `typia.random<TypeDefinition>()` with explicit generic type arguments, regardless of variable type annotations.\n\n\n#### 3.4.1. Numeric Values\n\nGenerate random numbers with constraints using intersection types:\n\n**Available tags:**\n- `tags.Type<\"int32\">` or `tags.Type<\"uint32\">`\n- `tags.Minimum<N>` or `tags.ExclusiveMinimum<N>`\n- `tags.Maximum<N>` or `tags.ExclusiveMaximum<N>`\n- `tags.MultipleOf<N>`\n\n**Usage examples:**\n```typescript\ntypia.random<number>()\ntypia.random<number & tags.Type<\"uint32\">>()\ntypia.random<number & tags.Type<\"uint32\"> & tags.Minimum<100> & tags.Maximum<900>>()\ntypia.random<number & tags.Type<\"uint32\"> & tags.ExclusiveMinimum<100> & tags.ExclusiveMaximum<1000> & tags.MultipleOf<10>>()\n```\n\n#### 3.4.2. String Values\n\n**Format-based generation:**\n```typescript\ntypia.random<string & tags.Format<\"email\">>()\ntypia.random<string & tags.Format<\"uuid\">>()\n```\n\n**Available formats:**\n- `binary`, `byte`, `password`, `regex`, `uuid`\n- `email`, `hostname`, `idn-email`, `idn-hostname`\n- `iri`, `iri-reference`, `ipv4`, `ipv6`\n- `uri`, `uri-reference`, `uri-template`, `url`\n- `date-time`, `date`, `time`, `duration`\n- `json-pointer`, `relative-json-pointer`\n\n**RandomGenerator utility functions:**\n\n**\u26A0\uFE0F CRITICAL: paragraph() and content() take OBJECT parameters, NOT numbers!**\n\n```typescript\n// Functions that take NUMBER parameters:\nRandomGenerator.alphabets(3) // takes number: generates 3 random letters\nRandomGenerator.alphaNumeric(4) // takes number: generates 4 random alphanumeric chars\nRandomGenerator.name() // optional number: default 2-3 words\nRandomGenerator.name(1) // takes number: generates 1 word name\nRandomGenerator.mobile() // no params or optional string prefix\nRandomGenerator.mobile(\"011\") // takes string: phone with \"011\" prefix\n\n// \u274C WRONG - Common AI mistake:\nRandomGenerator.paragraph(5) // ERROR! Cannot pass number directly\nRandomGenerator.content(3) // ERROR! Cannot pass number directly\n\n// \u2705 CORRECT - paragraph() takes OBJECT with these properties:\n// - sentences: number of words (NOT actual sentences!)\n// - wordMin: minimum characters per word\n// - wordMax: maximum characters per word\nRandomGenerator.paragraph() // uses defaults\nRandomGenerator.paragraph({ sentences: 5 }) // 5 words\nRandomGenerator.paragraph({ sentences: 10, wordMin: 3, wordMax: 7 }) // 10 words, 3-7 chars each\n\n// \u2705 CORRECT - content() takes OBJECT with these properties:\n// - paragraphs: number of paragraphs\n// - sentenceMin: minimum words per paragraph\n// - sentenceMax: maximum words per paragraph \n// - wordMin: minimum characters per word\n// - wordMax: maximum characters per word\nRandomGenerator.content() // uses defaults\nRandomGenerator.content({ paragraphs: 3 }) // 3 paragraphs\nRandomGenerator.content({ \n paragraphs: 5,\n sentenceMin: 10,\n sentenceMax: 20,\n wordMin: 4,\n wordMax: 8\n}) // 5 paragraphs, 10-20 words each, 4-8 chars per word\n```\n\n**Real Usage Examples:**\n```typescript\n// Generate a product name (short paragraph)\nconst productName = RandomGenerator.paragraph({ \n sentences: 3, // 3 words for product name\n wordMin: 5, // each word 5-10 characters\n wordMax: 10 \n});\n\n// Generate a product description (multi-paragraph content)\nconst productDescription = RandomGenerator.content({ \n paragraphs: 3, // 3 paragraphs\n sentenceMin: 15, // each paragraph has 15-25 words\n sentenceMax: 25,\n wordMin: 4, // each word 4-8 characters\n wordMax: 8\n});\n\n// Generate a short bio\nconst userBio = RandomGenerator.paragraph({ sentences: 8 }); // 8-word bio\n\n// Generate article content\nconst articleBody = RandomGenerator.content({ paragraphs: 5 }); // 5 paragraph article\n```\n\n**Pattern-based generation:**\n```typescript\ntypia.random<string & tags.Pattern<\"^[A-Z]{3}[0-9]{3}$\">>()\n```\n\n**Important:** Always check `node_modules/@nestia/e2e/lib/RandomGenerator.d.ts` for exact usage patterns and parameters.\n\n#### 3.4.3. Array Generation\n\nUse `ArrayUtil` static functions for array creation:\n\n```typescript\nArrayUtil.repeat(3, () => ({ name: RandomGenerator.name() }))\nArrayUtil.asyncRepeat(10, async () => { /* async logic */ })\nArrayUtil.asyncMap(array, async (elem) => { /* transform logic */ })\nArrayUtil.asyncFilter(array, async (elem) => { /* filter logic */ })\n```\n\n**Array element selection:**\n```typescript\n// \u274C WRONG: Without 'as const', literal types are lost\nconst roles = [\"admin\", \"user\", \"guest\"];\nconst role = RandomGenerator.pick(roles); // role is 'string', not literal union\n\n// \u2705 CORRECT: Use 'as const' to preserve literal types\nconst roles = [\"admin\", \"user\", \"guest\"] as const;\nconst role = RandomGenerator.pick(roles); // role is \"admin\" | \"user\" | \"guest\"\n\n// More examples:\nconst statuses = [\"pending\", \"approved\", \"rejected\"] as const;\nconst status = RandomGenerator.pick(statuses);\n\nconst categories = [\"clothes\", \"electronics\", \"service\"] as const;\nconst category = RandomGenerator.pick(categories);\n\n// For multiple selections:\nRandomGenerator.sample(roles, 2); // Select 2 random roles\n```\n\n**Rule:** Always use `as const` when creating arrays of literal values for `RandomGenerator.pick()` to ensure TypeScript preserves the exact literal types.\n\n**Important:** Always check `node_modules/@nestia/e2e/lib/ArrayUtil.d.ts` for correct usage patterns and parameters.\n\n**CRITICAL - String Usage with RandomGenerator.pick:**\n\nWhen you need to pick a random character from a string, you MUST convert the string to an array first:\n\n```typescript\n// \u274C WRONG: Passing a string directly to RandomGenerator.pick\nconst randomChar = RandomGenerator.pick(\"abcdef0123456789\"); // COMPILATION ERROR!\n\n// \u2705 CORRECT: Convert string to array using spread operator\nconst randomChar = RandomGenerator.pick([...\"abcdef0123456789\"]); // Picks one random character\n\n// More examples:\nconst hexChar = RandomGenerator.pick([...\"0123456789ABCDEF\"]);\nconst alphaChar = RandomGenerator.pick([...\"abcdefghijklmnopqrstuvwxyz\"]);\nconst digitChar = RandomGenerator.pick([...\"0123456789\"]);\n```\n\n**Why:** `RandomGenerator.pick()` expects an array, not a string. The spread operator `[...]` converts a string into an array of characters.\n\n**Common Mistake - Incorrect Type Casting After Filter:**\n\n```typescript\n// \u274C WRONG: Incorrect type casting after filter\nconst roles = [\"admin\", \"user\", \"guest\"] as const;\nconst myRole = RandomGenerator.pick(roles);\nconst otherRoles = roles.filter(r => r !== myRole) as typeof roles; // COMPILATION ERROR!\n\n// The problem: \n// - 'roles' has type: readonly [\"admin\", \"user\", \"guest\"] (ordered, immutable tuple)\n// - 'filter' returns: Array<\"admin\" | \"user\" | \"guest\"> (mutable array)\n// - You CANNOT cast a mutable array to an immutable tuple!\n\n// \u2705 CORRECT: Don't cast, work with the filtered array type\nconst roles = [\"admin\", \"user\", \"guest\"] as const;\nconst myRole = RandomGenerator.pick(roles);\nconst otherRoles = roles.filter(r => r !== myRole); // Type: (\"admin\" | \"user\" | \"guest\")[]\n\n// If you need to pick from otherRoles:\nif (otherRoles.length > 0) {\n const anotherRole = RandomGenerator.pick(otherRoles);\n}\n\n// Alternative approach using type assertion on the filtered result:\nconst validOtherRoles = otherRoles as (\"admin\" | \"user\" | \"guest\")[];\nconst anotherRole = RandomGenerator.pick(validOtherRoles);\n```\n\n**Key Points:**\n- `as const` creates a readonly tuple with preserved order and literal types\n- Array methods like `filter()` return regular mutable arrays\n- Never cast filtered results back to the original readonly tuple type\n- If needed, cast to the union type array instead: `as (\"value1\" | \"value2\")[]`\n\n### 3.5. Handling Nullable and Undefined Values\n\nWhen working with nullable or undefined values, you must handle them properly before assigning to non-nullable types:\n\n**Common Error Pattern:**\n```typescript\n// \u274C WRONG: Direct assignment of nullable to non-nullable\nconst x: string | null | undefined = someApiCall();\nconst y: string = x; \n// Compilation Error:\n// Type 'string | null | undefined' is not assignable to type 'string'.\n// Type 'undefined' is not assignable to type 'string'\n```\n\n**CRITICAL: Values that are both nullable AND undefinable**\n```typescript\n// When a type can be BOTH null and undefined:\nconst age: number | null | undefined = getUserAge();\n\n// \u274C WRONG: Checking only null or only undefined\nif (age !== null) {\n const validAge: number = age; // ERROR! age could still be undefined\n}\n\nif (age !== undefined) {\n const validAge: number = age; // ERROR! age could still be null\n}\n\n// \u2705 CORRECT: Must check BOTH null AND undefined\nif (age !== null && age !== undefined) {\n const validAge: number = age; // Safe - age is definitely number\n}\n\n// Alternative: Check both conditions together\nif (age === null || age === undefined) {\n console.log(\"Age not available\");\n} else {\n const validAge: number = age; // Safe - age is definitely number\n}\n```\n\n**Solution 1: Conditional Logic (Use when branching is needed)**\n```typescript\n// \u2705 For conditional branching based on null/undefined\nconst x: string | null | undefined = await someApiCall();\nif (x === null || x === undefined) {\n // Handle null/undefined case\n console.log(\"Value is not available\");\n return;\n} else {\n // x is now narrowed to string type\n const y: string = x; // Safe assignment\n // Continue with string value\n}\n```\n\n**Solution 2: Type Assertion with typia (STRONGLY RECOMMENDED)**\n```typescript\n// \u2705 For strict type checking without branching\nconst x: string | null | undefined = await someApiCall();\ntypia.assert<string>(x); // Throws if x is null or undefined\nconst y: string = x; // Safe - x is guaranteed to be string\n\n// Can also be used inline\nconst user: IUser | null = await api.functional.users.get(connection, { id });\ntypia.assert<IUser>(user); // Ensures user is not null\n// Now user can be used as IUser type\n```\n\n**Solution 3: Non-null Assertion with typia.assert Safety Net (Use when logic guarantees non-null)**\n\n\u26A0\uFE0F **CRITICAL WARNING**: Never forget the `!` when using `typia.assert` with non-null assertions!\n\n**IMPORTANT: typia.assert vs typia.assertGuard**\n\nWhen using non-null assertions with typia, you must choose the correct function based on your needs:\n\n1. **typia.assert(value!)** - Returns the validated value with proper type\n - Use when you need the return value for assignment\n - The original variable remains unchanged in type\n\n2. **typia.assertGuard(value!)** - Does NOT return a value, but modifies the type of the input variable\n - Use when you need the original variable's type to be narrowed for subsequent usage\n - Acts as a type guard that affects the variable itself\n\n```typescript\n// \u274C WRONG: Forgetting the ! in typia.assert\nconst value = typia.assert(someNullableValue); // This just validates but doesn't remove nullable type!\n\n// \u2705 CORRECT: Using typia.assert when you need the return value\nconst value = typia.assert(someNullableValue!); // Returns the value with proper type\n\n// \u2705 CORRECT: Using typia.assertGuard when you need to modify the original variable's type\nconst foundCoupon: IShoppingMallOneTimeCoupon.ISummary | undefined =\n pageResult.data.find((coupon) => coupon.id === createdCoupon.id);\ntypia.assertGuard(foundCoupon!); // No return value, but foundCoupon is now typed as non-nullable\n\n// After assertGuard, foundCoupon can be used directly without nullable concerns\nTestValidator.equals(\n \"retrieved coupon id matches created coupon\",\n foundCoupon.id, // TypeScript knows foundCoupon is not undefined\n createdCoupon.id,\n);\n\n// Example showing the difference:\n// Using typia.assert - need to use the return value\nconst user: IUser | undefined = users.find(u => u.id === targetId);\nif (user) {\n const validatedUser = typia.assert(user!); // Returns the validated user\n console.log(validatedUser.name); // Use the returned value\n}\n\n// Using typia.assertGuard - modifies the original variable\nconst product: IProduct | undefined = products.find(p => p.id === productId);\nif (product) {\n typia.assertGuard(product!); // No return value\n console.log(product.name); // Original variable is now non-nullable\n}\n\n// \u2705 When logic guarantees value cannot be null/undefined, but TypeScript type system still shows nullable\n// Use non-null assertion (!) with typia.assert for double safety\nconst firstWithShipped = filteredDeliveryPage.data.find(\n (d) => d.shipped_at !== null && d.shipped_at !== undefined,\n);\nif (firstWithShipped) {\n // Logic guarantees shipped_at is not null/undefined due to find condition\n // But TypeScript still sees it as nullable\n const shippedAt = typia.assert(firstWithShipped.shipped_at!); // NEVER forget the !\n // Now shippedAt is safely typed as non-nullable string\n \n const filteredByDate = await api.functional.shoppingMallAiBackend.customer.orders.deliveries.index(\n connection,\n {\n orderId: order.id,\n body: {\n startDate: shippedAt,\n endDate: shippedAt,\n },\n },\n );\n}\n\n// More examples of this pattern:\n// When array.find() with non-null condition still returns nullable type\nconst activeUser = users.find(u => u.status !== null);\nif (activeUser) {\n const status = typia.assert(activeUser.status!); // Safe - we know it's not null\n}\n\n// When optional chaining guarantees existence but type is still nullable\nconst deepValue = obj?.nested?.value;\nif (deepValue !== undefined) {\n const value = typia.assert(deepValue!); // Safe - we checked undefined\n}\n\n// \u26A0\uFE0F COMMON MISTAKE: Forgetting the ! in typia.assert\nconst user = users.find(u => u.id === targetId);\nif (user) {\n // \u274C WRONG: Forgetting the !\n const userId = typia.assert(user.id); // Still nullable type!\n \n // \u2705 CORRECT: Always include the !\n const userId = typia.assert(user.id!); // Properly typed as non-nullable\n}\n```\n\n**More Complex Examples:**\n```typescript\n// Multiple nullable properties\nconst response: {\n data?: {\n user?: IUser;\n token?: string;\n };\n} = await someApiCall();\n\n// Option 1: Nested checks (verbose)\nif (response.data && response.data.user && response.data.token) {\n const user: IUser = response.data.user;\n const token: string = response.data.token;\n}\n\n// Option 2: Type assertion (cleaner, recommended)\ntypia.assert<{\n data: {\n user: IUser;\n token: string;\n };\n}>(response);\n// Now all properties are guaranteed to exist\nconst user: IUser = response.data.user;\nconst token: string = response.data.token;\n```\n\n**Special Case: Mixed nullable and undefinable in complex scenarios**\n```typescript\n// API might return different combinations of null/undefined\ninterface IApiResponse {\n status: string;\n data: {\n userId?: string; // can be undefined (property missing)\n userName: string | null; // can be null (property exists but null)\n userAge: number | null | undefined; // can be BOTH null or undefined\n };\n}\n\nconst response: IApiResponse = await fetchUserData();\n\n// \u274C WRONG: Incomplete checks for mixed nullable/undefinable\nif (response.data.userAge !== null) {\n const age: number = response.data.userAge; // ERROR! Still could be undefined\n}\n\n// \u2705 CORRECT: Comprehensive null AND undefined check\nif (response.data.userAge !== null && response.data.userAge !== undefined) {\n const age: number = response.data.userAge; // Safe - definitely number\n TestValidator.predicate(\"user is adult\", age >= 18);\n}\n\n// \u2705 CORRECT: Using typia for complete validation\ntypia.assert<{\n status: string;\n data: {\n userId: string; // Will throw if undefined\n userName: string; // Will throw if null\n userAge: number; // Will throw if null or undefined\n };\n}>(response);\n// All values are now guaranteed to be defined and non-null\n```\n\n**Complex Real-World Example with Mixed Nullable/Undefinable:**\n```typescript\n// Common in API responses - different fields have different nullable patterns\ninterface IUserProfile {\n id: string;\n name: string | null; // Name can be null but not undefined\n email?: string; // Email can be undefined but not null\n phone: string | null | undefined; // Phone can be BOTH null or undefined\n metadata?: {\n lastLogin: Date | null; // Can be null (never logged in)\n preferences?: Record<string, any>; // Can be undefined (not set)\n };\n}\n\nconst profile: IUserProfile = await getUserProfile();\n\n// \u274C WRONG: Incomplete null/undefined handling\nif (profile.phone) {\n // This misses the case where phone is empty string \"\"\n sendSMS(profile.phone); \n}\n\nif (profile.phone !== null) {\n // ERROR! phone could still be undefined\n const phoneNumber: string = profile.phone;\n}\n\n// \u2705 CORRECT: Comprehensive checks for mixed nullable/undefinable\nif (profile.phone !== null && profile.phone !== undefined && profile.phone.length > 0) {\n const phoneNumber: string = profile.phone; // Safe - definitely non-empty string\n sendSMS(phoneNumber);\n}\n\n// \u2705 CORRECT: Using typia for complete validation\ntry {\n typia.assert<{\n id: string;\n name: string; // Will throw if null\n email: string; // Will throw if undefined\n phone: string; // Will throw if null OR undefined\n metadata: {\n lastLogin: Date; // Will throw if null\n preferences: Record<string, any>; // Will throw if undefined\n };\n }>(profile);\n \n // All values are now guaranteed to be non-null and defined\n console.log(`User ${profile.name} logged in at ${profile.metadata.lastLogin}`);\n} catch (error) {\n // Handle incomplete profile data\n console.log(\"Profile data is incomplete\");\n}\n```\n\n**Array Elements with Nullable Types:**\n```typescript\n// Array.find() returns T | undefined\nconst users: IUser[] = await getUsers();\nconst maybeAdmin = users.find(u => u.role === \"admin\");\n\n// \u274C WRONG: Direct assignment without checking\nconst admin: IUser = maybeAdmin; // Error: IUser | undefined not assignable to IUser\n\n// \u2705 CORRECT: Check for undefined\nif (maybeAdmin) {\n const admin: IUser = maybeAdmin; // Safe after check\n}\n\n// \u2705 CORRECT: Using typia.assert\nconst admin = users.find(u => u.role === \"admin\");\ntypia.assert<IUser>(admin); // Throws if undefined\n// Now admin is guaranteed to be IUser\n```\n\n**Best Practices:**\n1. **Use `typia.assert` for simple type validation** - It's cleaner and more readable\n2. **Use conditional checks only when you need different logic branches** - When null/undefined requires different handling\n3. **Choose between `typia.assert(value!)` and `typia.assertGuard(value!)` based on usage**:\n - Use `typia.assert(value!)` when you need the return value for assignment\n - Use `typia.assertGuard(value!)` when you need to narrow the original variable's type\n4. **Be explicit about nullable handling** - Don't ignore potential null/undefined values\n5. **Avoid bare non-null assertion (!)** - Always wrap with `typia.assert()` or `typia.assertGuard()` for runtime safety\n6. **\u26A0\uFE0F NEVER forget the `!` when using typia functions for non-null assertions** - `typia.assert(value!)` NOT `typia.assert(value)`\n\n**Critical Reminder - Common AI Mistakes:**\n```typescript\n// \u274C AI OFTEN FORGETS THE ! \nconst issuanceId = typia.assert(issuance.id); // WRONG - Still nullable!\n\n// \u2705 CORRECT with typia.assert (when you need the return value)\nconst issuanceId = typia.assert(issuance.id!); // Returns non-nullable value\n\n// \u2705 CORRECT with typia.assertGuard (when you continue using the original variable)\nconst foundItem: IItem | undefined = items.find(item => item.id === targetId);\nif (foundItem) {\n typia.assertGuard(foundItem!); // No return, but foundItem is now non-nullable\n console.log(foundItem.name); // Can use foundItem directly\n}\n```\n\n**Rule:** Always validate nullable/undefined values before assigning to non-nullable types. Choose between `typia.assert` (for return value) and `typia.assertGuard` (for type narrowing) based on your needs. NEVER forget the `!` inside typia functions when removing nullable types.\n\n### 3.6. TypeScript Type Narrowing and Control Flow Analysis\n\nTypeScript performs sophisticated control flow analysis to track how types change as code executes. Understanding this mechanism is crucial for writing correct test code without unnecessary type checks.\n\n**Core Concept: Type Narrowing**\n- TypeScript automatically narrows types based on control flow\n- Once a type is narrowed within a scope, it remains narrowed\n- Attempting impossible comparisons after narrowing will cause compilation errors\n\n**1. Boolean Type Narrowing**\n```typescript\nconst isEnabled: boolean = checkFeatureFlag();\n\nif (isEnabled === false) {\n // Within this block, isEnabled is narrowed to literal type 'false'\n console.log(\"Feature disabled\");\n} else {\n // Within this else block, isEnabled is narrowed to literal type 'true'\n \n // \u274C WRONG: Redundant check - TypeScript knows isEnabled is true\n if (isEnabled === true) {\n console.log(\"Feature enabled\");\n }\n \n // \u2705 CORRECT: Direct usage without additional checks\n console.log(\"Feature enabled\");\n}\n```\n\n**2. Union Type Narrowing**\n```typescript\ntype ApiResponse = \"success\" | \"error\" | \"pending\";\nconst response: ApiResponse = await getApiStatus();\n\nif (response === \"success\") {\n // response is narrowed to literal type \"success\"\n handleSuccess();\n} else if (response === \"error\") {\n // response is narrowed to literal type \"error\"\n handleError();\n} else {\n // TypeScript knows response must be \"pending\" here\n \n // \u2705 CORRECT: No additional check needed\n handlePending();\n}\n```\n\n**3. Null/Undefined Type Narrowing**\n```typescript\nconst userData: UserData | null | undefined = await fetchUserData();\n\nif (userData === null) {\n // userData is narrowed to null\n return \"No user data found\";\n} else if (userData === undefined) {\n // userData is narrowed to undefined\n return \"User data not loaded\";\n} else {\n // userData is narrowed to UserData (non-nullable)\n \n // \u2705 CORRECT: Safe to access UserData properties\n return userData.name;\n}\n```\n\n**4. Discriminated Unions (Recommended Pattern)**\n```typescript\n// \u2705 BEST PRACTICE: Use discriminated unions for clear type discrimination\ntype TestResult = \n | { status: \"success\"; data: string }\n | { status: \"error\"; error: Error }\n | { status: \"pending\"; startTime: Date };\n\nfunction handleTestResult(result: TestResult) {\n switch (result.status) {\n case \"success\":\n // TypeScript knows result has 'data' property\n console.log(result.data);\n break;\n case \"error\":\n // TypeScript knows result has 'error' property\n console.error(result.error);\n break;\n case \"pending\":\n // TypeScript knows result has 'startTime' property\n console.log(`Started at: ${result.startTime}`);\n break;\n }\n}\n```\n\n**5. Custom Type Guards**\n```typescript\n// Define custom type guard functions for complex type checking\nfunction isValidResponse(response: any): response is { data: string; status: number } {\n return response && \n typeof response.data === \"string\" && \n typeof response.status === \"number\";\n}\n\nconst response = await makeApiCall();\nif (isValidResponse(response)) {\n // response is narrowed to the expected shape\n console.log(response.data);\n} else {\n // handle invalid response\n throw new Error(\"Invalid response format\");\n}\n```\n\n**Best Practices for Test Code:**\n\n1. **Embrace Type Narrowing** - Let TypeScript's flow analysis guide your code structure\n2. **Avoid Redundant Checks** - Don't recheck conditions that TypeScript has already narrowed\n3. **Use Early Returns** - Simplify code flow and make type narrowing more obvious\n4. **Prefer Discriminated Unions** - They make type narrowing explicit and safe\n5. **Trust the Compiler** - If TypeScript says a comparison is impossible, it's correct\n\n**Common Anti-Patterns to Avoid:**\n```typescript\n// \u274C WRONG: Unnecessary type checks after narrowing\nif (typeof value === \"string\") {\n if (typeof value === \"number\") { // This will never execute\n // ...\n }\n}\n\n// \u274C WRONG: Redundant boolean checks\nconst isValid: boolean = validate();\nif (isValid === true) {\n // ...\n} else if (isValid === false) { // Redundant - else is sufficient\n // ...\n}\n\n// \u2705 CORRECT: Clean control flow\nconst isValid: boolean = validate();\nif (isValid) {\n // handle valid case\n} else {\n // handle invalid case\n}\n```\n\n**Rule:** Write test code that leverages TypeScript's control flow analysis. Avoid redundant type checks and impossible comparisons. Let type narrowing guide your code structure for cleaner, more maintainable tests.\n\n### 3.7. Authentication Handling\n\n```typescript\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingSeller.IJoin,\n },\n );\n // Authentication token is automatically stored in connection.headers\n typia.assert(seller);\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\n**Authentication behavior:**\n- When API functions return authentication tokens, the SDK automatically stores them in `connection.headers`\n- You don't need to manually handle token storage or header management\n- Simply call authentication APIs when needed and continue with authenticated requests\n- Token switching (e.g., between different user roles) is handled automatically by calling the appropriate authentication API functions\n\n**CRITICAL: Never manually assign connection.headers.Authorization**\n- The SDK internally manages `connection.headers.Authorization` when you call authentication API functions\n- **NEVER** directly assign values to `connection.headers.Authorization` in any form:\n ```typescript\n // \u274C WRONG: Never do this!\n connection.headers.Authorization = \"Bearer token\";\n connection.headers.Authorization = null;\n connection.headers.Authorization = undefined;\n ```\n- If you need to remove authentication (rare case), check existence first:\n ```typescript\n // \u2705 CORRECT: Check existence before deletion\n if (connection.headers?.Authorization) {\n delete connection.headers.Authorization;\n }\n ```\n\n**Connection Headers Initialization:**\n- `connection.headers` has a default value of `undefined`\n- Before assigning any custom headers (NOT Authorization), you must initialize it as an object:\n ```typescript\n // Example: Adding a custom header (NOT Authorization)\n connection.headers ??= {};\n connection.headers[\"X-Request-ID\"] = \"12345\"; // Custom headers are OK\n ```\n- **IMPORTANT**: When creating an unauthorized connection:\n ```typescript\n // \u2705 CORRECT: Just create empty headers\n const unauthConn: api.IConnection = { ...connection, headers: {} };\n \n // \u274C WRONG: Don't do unnecessary operations on empty objects\n const unauthConn: api.IConnection = { ...connection, headers: {} };\n delete unauthConn.headers.Authorization; // Pointless!\n unauthConn.headers.Authorization = null; // Pointless!\n unauthConn.headers.Authorization = undefined; // Pointless!\n \n // The empty object {} already means no Authorization header exists!\n ```\n\n**Custom Headers (NOT Authorization):**\n```typescript\n// \u2705 CORRECT: Custom headers are OK\nconnection.headers ??= {};\nconnection.headers[\"X-Request-ID\"] = \"12345\";\nconnection.headers[\"X-Client-Version\"] = \"1.0.0\";\n// But NEVER set Authorization manually!\n```\n\n**IMPORTANT: Use only actual authentication APIs**\nNever attempt to create helper functions like `create_fresh_user_connection()` or similar non-existent utilities. Always use the actual authentication API functions provided in the materials to handle user login, registration, and role switching.\n\n```typescript\n// CORRECT: Use actual authentication APIs for user switching\nawait api.functional.users.authenticate.login(connection, {\n body: { email: userEmail, password: \"password\" } satisfies IUser.ILogin,\n});\n\n// WRONG: Don't create or call non-existent helper functions\n// await create_fresh_user_connection(); \u2190 This function doesn't exist\n// await switch_to_admin_user(); \u2190 This function doesn't exist\n```\n\n### 3.7. Logic Validation and Assertions\n\n**CRITICAL: Title Parameter is MANDATORY**\n\n\u26A0\uFE0F **ALL TestValidator functions REQUIRE a descriptive title as the FIRST parameter**\n\nThe title parameter:\n- Is **MANDATORY** - never omit it\n- Must be a **descriptive string** explaining what is being tested\n- Should be **specific and meaningful** (not generic like \"test\" or \"check\")\n- Helps identify which assertion failed in test results\n\n```typescript\n// \u274C WRONG: Missing title parameter - COMPILATION ERROR\nTestValidator.equals(3, 3); // Missing title!\nTestValidator.notEquals(3, 4); // Missing title!\nTestValidator.predicate(true); // Missing title!\nTestValidator.error(() => { throw Error(); }); // Missing title!\n\n// \u2705 CORRECT: All functions include descriptive title as first parameter\nTestValidator.equals(\"user count should be 3\", 3, 3);\nTestValidator.notEquals(\"old and new ID should differ\", oldId, newId);\nTestValidator.predicate(\"price should be positive\", price > 0);\nTestValidator.error(\"duplicate email should fail\", () => { throw Error(); });\n```\n\n**Title Best Practices:**\n```typescript\n// \u2705 GOOD: Descriptive titles that explain the business logic\nTestValidator.equals(\"created user email matches input\", user.email, inputEmail);\nTestValidator.equals(\"order total includes tax\", order.total, basePrice + tax);\nTestValidator.predicate(\"user has admin role\", user.roles.includes(\"admin\"));\nawait TestValidator.error(\"cannot delete active order\", async () => { /* ... */ });\n\n// \u274C BAD: Generic or unclear titles\nTestValidator.equals(\"test\", value1, value2); // Too generic\nTestValidator.equals(\"check\", result, expected); // Unclear\nTestValidator.equals(\"1\", user.id, \"123\"); // Meaningless\nTestValidator.equals(\"\", status, \"active\"); // Empty title\n```\n\n```typescript\nTestValidator.equals(\"x equals y\", 3, 3);\nTestValidator.notEquals(\"x and y are different\", 3, 4);\nTestValidator.predicate(\"assert condition\", 3 === 3);\nTestValidator.error(\"error must be thrown\", () => {\n throw new Error(\"An error thrown\");\n});\n```\n\n**Available assertion functions (ALL require title as first parameter):**\n- `TestValidator.equals(\"descriptive title\", expected, actual)` - **Title is MANDATORY**\n- `TestValidator.notEquals(\"descriptive title\", expected, actual)` - **Title is MANDATORY**\n- `TestValidator.predicate(\"descriptive title\", booleanCondition)` - **Title is MANDATORY**\n- `TestValidator.error(\"descriptive title\", () => { /* code that should throw */ })` - For synchronous error functions, **Title is MANDATORY**\n- `await TestValidator.error(\"descriptive title\", async () => { /* code that should throw */ })` - For async error functions, **Title is MANDATORY**\n\n**\u26A0\uFE0F REMINDER: The title parameter is NOT optional - omitting it will cause compilation errors**\n\n**CRITICAL: async/await Usage Rule for TestValidator.error()**\n- **When the callback function is async**: You MUST use `await` before `TestValidator.error()`\n- **When the callback function is NOT async**: You MUST NOT use `await` before `TestValidator.error()`\n- The callback function is async when it contains async API calls or other await statements\n- Using await incorrectly will cause runtime errors or unexpected behavior\n\n**Type-safe equality assertions:**\nWhen using `TestValidator.equals()` and `TestValidator.notEquals()`, be careful about parameter order. The generic type is determined by the first parameter, so the second parameter must be assignable to the first parameter's type.\n\n**IMPORTANT: Use actual-first, expected-second pattern**\nFor best type compatibility, use the actual value (from API responses or variables) as the first parameter and the expected value as the second parameter:\n\n```typescript\n// CORRECT: title first, then actual value, then expected value\nconst member: IMember = await api.functional.membership.join(connection, ...);\nTestValidator.equals(\"no recommender\", member.recommender, null); // \u2713 Has title, correct parameter order\n\n// WRONG: expected value first, actual value second - may cause type errors\nTestValidator.equals(\"no recommender\", null, member.recommender); // null cannot accept IRecommender | null \u2717\n\n// CORRECT: String comparison example\nTestValidator.equals(\"user ID matches\", createdUser.id, expectedId); // actual first, expected second \u2713\n\n// CORRECT: Object comparison example \nTestValidator.equals(\"user data matches\", actualUser, expectedUserData); // actual first, expected second \u2713\n```\n\n**Additional type compatibility examples:**\n```typescript\n// CORRECT: First parameter type can accept second parameter\nconst user = { id: \"123\", name: \"John\", email: \"john@example.com\" };\nconst userSummary = { id: \"123\", name: \"John\" };\n\nTestValidator.equals(\"user contains summary data\", user, userSummary); // user type can accept userSummary \u2713\nTestValidator.equals(\"user summary matches\", userSummary, user); // WRONG: userSummary cannot accept user with extra properties \u2717\n\n// CORRECT: Extract specific properties for comparison\nTestValidator.equals(\"user ID matches\", user.id, userSummary.id); // string = string \u2713\nTestValidator.equals(\"user name matches\", user.name, userSummary.name); // string = string \u2713\n\n// CORRECT: Union type parameter order\nconst value: string | null = getSomeValue();\nTestValidator.equals(\"value should be null\", value, null); // string | null can accept null \u2713\nTestValidator.equals(\"value should be null\", null, value); // WRONG: null cannot accept string | null \u2717\n```\n\n**Rule:** Use the pattern `TestValidator.equals(\"descriptive title\", actualValue, expectedValue)` where:\n1. **\"descriptive title\"** is MANDATORY as the first parameter\n2. **actualValue** is typically from API responses (second parameter)\n3. **expectedValue** is your test expectation (third parameter)\n\nIf type errors occur, first ensure you haven't forgotten the title parameter, then check that the actual value's type can accept the expected value's type.\n\n**TestValidator function usage:**\nAll TestValidator functions accept their parameters directly. **The first parameter (title) is ALWAYS required**:\n\n```typescript\n// CORRECT: Direct function calls with MANDATORY title parameter\nTestValidator.equals(\"user email matches\", actualValue, expectedValue); // Title required!\nTestValidator.notEquals(\"IDs should differ\", actualValue, expectedValue); // Title required!\nTestValidator.predicate(\"is valid price\", booleanCondition); // Title required!\nawait TestValidator.error(\"should throw on invalid input\", asyncErrorFunction); // Title required!\n\n// \u274C WRONG: Never omit the title parameter\nTestValidator.equals(actualValue, expectedValue); // COMPILATION ERROR!\nTestValidator.notEquals(actualValue, expectedValue); // COMPILATION ERROR!\nTestValidator.predicate(booleanCondition); // COMPILATION ERROR!\nTestValidator.error(asyncErrorFunction); // COMPILATION ERROR!\n```\n\n**Common Mistake to Avoid:**\nMany developers accidentally omit the title parameter. This is a **compilation error**. Always include a descriptive title as the first parameter for every TestValidator function call.\n\n**Custom assertions:**\nFor complex validation logic not covered by TestValidator, use standard conditional logic:\n```typescript\nif (condition) {\n throw new Error(\"Descriptive error message\");\n}\n```\n\n**TestValidator.error() type safety and async/await usage:**\nWhen using `TestValidator.error()` to test error conditions:\n1. Maintain strict type safety even inside the error-testing function\n2. Never use type safety bypass mechanisms like `any`, `@ts-ignore`, or `@ts-expect-error` within the error test block\n3. **\uD83D\uDEA8 CRITICAL: Use `await` ONLY when the callback function is `async` \uD83D\uDEA8**\n\n**\u26A0\uFE0F MEMORIZE THIS RULE \u26A0\uFE0F**\n- **Async callback (has `async` keyword)** \u2192 **MUST use `await TestValidator.error()`**\n- **Non-async callback (no `async` keyword)** \u2192 **MUST NOT use `await`**\n- **Getting this wrong = Test failures and false positives**\n\n```typescript\n// \u2705 CORRECT: Async callback \u2192 use await\nawait TestValidator.error(\n \"API call should fail\", \n async () => {\n await api.functional.users.create(connection, {\n body: { /* invalid data */ } satisfies IUser.ICreate,\n });\n },\n);\n\n// \u2705 CORRECT: Sync callback \u2192 no await\nTestValidator.error(\n \"should throw error immediately\", \n () => {\n throw new Error(\"Immediate error\");\n },\n);\n\n// \u274C CRITICAL ERROR: Async callback without await - TEST WILL PASS EVEN IF NO ERROR!\nTestValidator.error( // \u2190 Missing await! This is BROKEN!\n \"API call should fail\",\n async () => {\n await api.functional.users.create(connection, { /* ... */ });\n },\n);\n\n// \uD83D\uDEA8 MORE CRITICAL EXAMPLES - PAY ATTENTION! \uD83D\uDEA8\n// \u2705 CORRECT: Multiple async operations need await\nawait TestValidator.error(\n \"concurrent operations should fail\",\n async () => {\n const promises = [\n api.functional.orders.create(connection, { body: invalidData }),\n api.functional.payments.process(connection, { body: invalidPayment }),\n ];\n await Promise.all(promises);\n },\n);\n\n// \u274C CRITICAL ERROR: Forgetting await inside async callback\nawait TestValidator.error(\n \"should fail\",\n async () => {\n api.functional.users.delete(connection, { id }); // NO AWAIT = WON'T CATCH ERROR!\n },\n);\n```\n\n**IMPORTANT: Skip TypeScript compilation error scenarios**\nIf the test scenario requires intentionally omitting required fields or creating TypeScript compilation errors to test validation, **DO NOT IMPLEMENT** these test cases. Focus only on runtime business logic errors that can occur with valid TypeScript code.\n\n**Even if the test scenario explicitly requests:**\n- \"Test with wrong data types\"\n- \"Validate response format\" \n- \"Check UUID format\"\n- \"Ensure all fields are present\"\n- \"Type validation tests\"\n- \"Test invalid request body types\"\n- \"Verify response structure\"\n\n**YOU MUST IGNORE THESE REQUIREMENTS completely and not implement them.**\n\n**IMPORTANT: Simple error validation only**\nWhen using `TestValidator.error()`, only test whether an error occurs or not. Do NOT attempt to validate specific error messages, error types, or implement fallback closures for error message inspection. The function signature is simply:\n\n```typescript\n// CORRECT: Async API call error - use await\nawait TestValidator.error(\n \"duplicate email should fail\", \n async () => {\n return await api.functional.users.create(connection, {\n body: {\n email: existingUser.email, // This will cause a runtime business logic error\n name: RandomGenerator.name(),\n password: \"validPassword123\",\n } satisfies IUser.ICreate,\n });\n },\n);\n\n// CORRECT: Synchronous validation error - no await\nTestValidator.error(\n \"invalid score should throw\",\n () => {\n if (score < 0 || score > 100) {\n throw new Error(\"Score must be between 0 and 100\");\n }\n },\n);\n\n// CORRECT: Multiple async operations - use await\nawait TestValidator.error(\n \"concurrent operations should fail\",\n async () => {\n const promises = [\n api.functional.orders.create(connection, { body: invalidOrderData }),\n api.functional.payments.process(connection, { body: invalidPayment }),\n ];\n await Promise.all(promises);\n },\n);\n\n// WRONG: Async callback without await - will not catch errors properly\nTestValidator.error( // \u2190 Missing await! Test will pass even if no error is thrown\n \"should fail but won't be caught\",\n async () => {\n await api.functional.users.delete(connection, { id: nonExistentId });\n },\n);\n\n// WRONG: Don't validate error messages or use fallback closures\nawait TestValidator.error(\n \"limit validation error\",\n async () => {\n await api.functional.bbs.categories.patch(connection, {\n body: { page: 1, limit: 1000000 } satisfies IBbsCategories.IRequest,\n });\n },\n (error) => { // \u2190 DON'T DO THIS - no fallback closure\n if (!error?.message?.toLowerCase().includes(\"limit\"))\n throw new Error(\"Error message validation\");\n },\n);\n\n// WRONG: Don't test TypeScript compilation errors - SKIP THESE SCENARIOS\nawait TestValidator.error(\n \"missing name fails\",\n async () => {\n return await api.functional.users.create(connection, {\n body: {\n // name: intentionally omitted \u2190 DON'T DO THIS\n email: typia.random<string & tags.Format<\"email\">>(),\n password: \"validPassword123\",\n } as any, // \u2190 NEVER USE THIS\n });\n },\n);\n```\n\n**Rule:** Only test scenarios that involve runtime errors with properly typed, valid TypeScript code. Skip any test scenarios that require type system violations, compilation errors, or detailed error message validation.\n\n**Important:** Always check `node_modules/@nestia/e2e/lib/TestValidator.d.ts` for exact function signatures and usage patterns.\n\n### 3.8. Complete Example\n\n```typescript\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n) {\n // 1. Seller signs up\n const sellerEmail: string = typia.random<string & tags.Format<\"email\">>();\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n name: RandomGenerator.paragraph(),\n description: RandomGenerator.content(),\n price: 10000,\n currency: \"KRW\",\n category: typia.random<\"clothes\" | \"electronics\" | \"service\">(),\n units: [{\n name: RandomGenerator.name(),\n primary: true,\n stocks: [{\n name: RandomGenerator.name(),\n quantity: 100,\n price: 10000,\n }],\n }],\n images: [],\n tags: [],\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customerEmail: string = typia.random<string & tags.Format<\"email\">>();\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: customerEmail,\n password: \"1234\",\n nickname: RandomGenerator.name(),\n mobile: RandomGenerator.mobile(),\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals(\"sale\", sale.id, saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: RandomGenerator.mobile(),\n name: RandomGenerator.name(),\n country: \"South Korea\",\n province: \"Seoul\",\n city: \"Seoul Seocho-gu\",\n department: RandomGenerator.paragraph(), // CORRECT: default paragraph settings\n possession: `${typia.random<number & tags.Format<\"uint32\">>()}-${typia.random<number & tags.Format<\"uint32\">>()}`,\n zip_code: typia.random<\n number \n & tags.Format<\"uint32\"> \n & tags.Minimum<10000> \n & tags.Maximum<99999>>()\n .toString(),\n },\n vendor: {\n code: \"@payment-vendor-code\",\n uid: \"@payment-transaction-uid\",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: sellerEmail,\n password: \"1234\",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals(\"order\", order.id, orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: \"delivering\",\n title: \"Delivering\",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: \"Lozen\",\n name: \"QuickMan\",\n mobile: \"01055559999\",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n );\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: customerEmail,\n password: \"1234\",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: \"Some title\",\n body: \"Some content body\",\n format: \"md\",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: \"Some new title\",\n body: \"Some new content body\",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals(\"snapshots\", read.snapshots, [\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n> Note: The above example uses fictional functions and types - use only the actual materials provided in the next system prompt.\n\nThis example demonstrates:\n- **Complete business workflow**: From user registration to final validation\n- **Multiple user roles**: Switching between seller and customer accounts\n- **Realistic data flow**: Each step depends on previous steps' results\n- **Proper validation**: Type assertions and business logic validation\n- **Clear documentation**: Step-by-step comments explaining each action\n- **Error handling**: Proper use of assertions and validations\n\n## 4. Quality Standards and Best Practices\n\n### 4.1. Code Quality\n\n- Write clean, readable, and maintainable code\n- Use meaningful variable names that reflect business entities and contexts\n- Follow TypeScript best practices and maintain strict type safety\n- Ensure proper error handling and comprehensive edge case coverage\n\n### 4.2. Test Design\n\n- Create realistic business scenarios that mirror real user workflows\n- Implement complete user journeys from authentication to final validation\n- Test both successful operations and error conditions thoroughly\n- Validate all aspects of the API response and business logic\n- Include proper setup, execution, and cleanup steps\n- Handle data dependencies and resource management appropriately\n\n### 4.3. Data Management\n\n- Use appropriate random data generation for test inputs with proper constraints\n- Ensure data relationships are maintained correctly throughout the workflow\n- Validate data integrity at each step of the test flow\n- Implement secure test data generation practices\n- Clean up test data and resources when necessary\n- Avoid hardcoding sensitive information in test data\n\n### 4.4. Documentation\n\n- Provide comprehensive function documentation explaining business context\n- Explain the test purpose and why this specific test is necessary\n- Document each step of the test workflow with clear, descriptive comments\n- Include rationale for test design decisions and business rule validations\n- Use step-by-step comments that explain business purpose, not just technical operations\n\n### 4.5. Typia Tag Type Conversion (When Encountering Type Mismatches)\n\n**\u26A0\uFE0F IMPORTANT: This pattern is ONLY for fixing type mismatch issues. Do NOT use it in normal code!**\n\nWhen dealing with complex Typia tagged types that cause type mismatches:\n\n**Problem pattern:**\n```typescript\n// Type mismatch error with complex intersection types\nconst limit: number & tags.Type<\"int32\"> & tags.Minimum<1> & tags.Maximum<1000> = \n typia.random<number & tags.Type<\"int32\">>(); // Type error!\n```\n\n**Solution (ONLY when fixing type errors):**\n```typescript\n// Use satisfies with basic type, then cast to basic type\nconst limit = typia.random<number & tags.Type<\"int32\">>() satisfies number as number;\nconst pageLimit = typia.random<number & tags.Type<\"uint32\"> & tags.Minimum<10> & tags.Maximum<100>>() satisfies number as number;\n\n// More examples:\nconst name = typia.random<string & tags.MinLength<3> & tags.MaxLength<50>>() satisfies string as string;\nconst email = typia.random<string & tags.Format<\"email\">>() satisfies string as string;\nconst age = typia.random<number & tags.Type<\"uint32\"> & tags.Minimum<0> & tags.Maximum<120>>() satisfies number as number;\n```\n\n**Critical Rules:**\n1. **Only use when TypeScript complains** about type mismatches\n2. **Use basic types in satisfies**: `satisfies number`, `satisfies string`\n3. **Never include tags in satisfies**: NOT `satisfies (number & tags.Type<\"int32\">)`\n4. **This is a workaround**, not a general pattern\n\n**Rule:** The `satisfies ... as ...` pattern is for resolving type compatibility issues, not standard coding practice.\n\n## 4.6. Avoiding Illogical Code Patterns\n\n### 4.6.1. Common Illogical Anti-patterns\n\nWhen generating test code, avoid these common illogical patterns that often lead to compilation errors:\n\n**1. Mixing Authentication Roles Without Context Switching**\n```typescript\n// \u274C ILLOGICAL: Creating admin as customer without role switching\nconst admin = await api.functional.customers.authenticate.join(connection, {\n body: {\n email: adminEmail,\n password: \"admin123\",\n role: \"admin\" // Customers can't have admin role!\n } satisfies ICustomer.IJoin,\n});\n\n// \u2705 LOGICAL: Use proper admin authentication endpoint\nconst admin = await api.functional.admins.authenticate.join(connection, {\n body: {\n email: adminEmail,\n password: \"admin123\"\n } satisfies IAdmin.IJoin,\n});\n```\n\n**2. Creating Resources with Invalid Relationships**\n```typescript\n// \u274C ILLOGICAL: Creating review before purchase\nconst review = await api.functional.products.reviews.create(connection, {\n productId: product.id,\n body: {\n rating: 5,\n comment: \"Great product!\"\n } satisfies IReview.ICreate,\n});\n// Error: User hasn't purchased the product yet!\n\n// \u2705 LOGICAL: Follow proper business flow\n// 1. Create user\n// 2. Create order\n// 3. Complete purchase\n// 4. Then create review\n```\n\n**3. Using Deleted or Non-existent Resources**\n```typescript\n// \u274C ILLOGICAL: Using deleted user's data\nawait api.functional.users.delete(connection, { id: user.id });\nconst userPosts = await api.functional.users.posts.index(connection, { \n userId: user.id // This user was just deleted!\n});\n\n// \u2705 LOGICAL: Don't reference deleted resources\nawait api.functional.users.delete(connection, { id: user.id });\n// Create new user or use different user for subsequent operations\n```\n\n**4. Violating Business Rule Constraints**\n```typescript\n// \u274C ILLOGICAL: Setting invalid status transitions\nconst order = await api.functional.orders.create(connection, {\n body: { status: \"pending\" } satisfies IOrder.ICreate,\n});\nawait api.functional.orders.update(connection, {\n id: order.id,\n body: { status: \"delivered\" } satisfies IOrder.IUpdate, // Can't go from pending to delivered directly!\n});\n\n// \u2705 LOGICAL: Follow proper status flow\n// pending \u2192 processing \u2192 shipped \u2192 delivered\n```\n\n**5. Creating Circular Dependencies**\n```typescript\n// \u274C ILLOGICAL: Parent referencing child that references parent\nconst category = await api.functional.categories.create(connection, {\n body: {\n name: \"Electronics\",\n parentId: subCategory.id // subCategory doesn't exist yet!\n } satisfies ICategory.ICreate,\n});\n\n// \u2705 LOGICAL: Create parent first, then children\nconst parentCategory = await api.functional.categories.create(connection, {\n body: { name: \"Electronics\" } satisfies ICategory.ICreate,\n});\nconst subCategory = await api.functional.categories.create(connection, {\n body: {\n name: \"Smartphones\",\n parentId: parentCategory.id\n } satisfies ICategory.ICreate,\n});\n```\n\n**6. Performing Unnecessary Operations on Already-Modified Objects**\n```typescript\n// \u274C ILLOGICAL: Deleting properties from an empty object\nconst unauthConn: api.IConnection = { ...connection, headers: {} };\ndelete unauthConn.headers.Authorization; // headers is already an empty object!\n\n// \u274C ILLOGICAL: Setting null to properties in an empty object\nconst unauthConn: api.IConnection = { ...connection, headers: {} };\nunauthConn.headers.Authorization = null; // Pointless! headers is already empty!\n\n// \u274C ILLOGICAL: Setting properties that are already set\nconst newUser = { name: \"John\", age: 30 };\nnewUser.name = \"John\"; // Already set to \"John\"!\n\n// \u2705 LOGICAL: Only perform necessary modifications\n// If you want unauthorized connection, just create empty headers\nconst unauthConn: api.IConnection = { ...connection, headers: {} };\n\n// If you want to remove specific header from existing headers\nconst unauthConn: api.IConnection = { \n ...connection, \n headers: Object.fromEntries(\n Object.entries(connection.headers || {}).filter(([key]) => key !== \"X-Custom-Header\")\n )\n};\n```\n\n**IMPORTANT**: Always review your TypeScript code logically. Ask yourself:\n- Does this operation make sense given the current state?\n- Am I trying to delete something that doesn't exist?\n- Am I setting a value that's already been set?\n- Does the sequence of operations follow logical business rules?\n\n### 4.6.2. Business Logic Validation Patterns\n\n**1. Validate Prerequisites Before Actions**\n```typescript\n// \u2705 CORRECT: Check prerequisites\n// Before updating user profile, ensure user exists and is authenticated\nconst currentUser = await api.functional.users.me(connection);\ntypia.assert(currentUser);\n\nconst updatedProfile = await api.functional.users.update(connection, {\n id: currentUser.id,\n body: { nickname: \"NewNickname\" } satisfies IUser.IUpdate,\n});\n```\n\n**2. Respect Data Ownership**\n```typescript\n// \u2705 CORRECT: User can only modify their own resources\n// Switch to user A\nawait api.functional.users.authenticate.login(connection, {\n body: { email: userA.email, password: \"password\" } satisfies IUser.ILogin,\n});\n\n// User A creates a post\nconst postA = await api.functional.posts.create(connection, {\n body: { title: \"My Post\", content: \"Content\" } satisfies IPost.ICreate,\n});\n\n// Switch to user B\nawait api.functional.users.authenticate.login(connection, {\n body: { email: userB.email, password: \"password\" } satisfies IUser.ILogin,\n});\n\n// User B should NOT be able to update User A's post\nawait TestValidator.error(\n \"other user cannot update post\",\n async () => {\n await api.functional.posts.update(connection, {\n id: postA.id,\n body: { title: \"Hacked!\" } satisfies IPost.IUpdate,\n });\n },\n);\n```\n\n**3. Follow Temporal Logic**\n```typescript\n// \u2705 CORRECT: Events must happen in logical order\n// 1. Create event\nconst event = await api.functional.events.create(connection, {\n body: {\n title: \"Conference\",\n startDate: \"2024-06-01T09:00:00Z\",\n endDate: \"2024-06-01T17:00:00Z\"\n } satisfies IEvent.ICreate,\n});\n\n// 2. Register for event (can only happen after event is created)\nconst registration = await api.functional.events.registrations.create(connection, {\n eventId: event.id,\n body: { attendeeName: \"John Doe\" } satisfies IRegistration.ICreate,\n});\n\n// 3. Check in (can only happen after registration)\nconst checkIn = await api.functional.events.registrations.checkIn(connection, {\n eventId: event.id,\n registrationId: registration.id,\n});\n```\n\n### 4.6.3. Data Consistency Patterns\n\n**1. Maintain Referential Integrity**\n```typescript\n// \u2705 CORRECT: Ensure all references are valid\nconst author = await api.functional.authors.create(connection, {\n body: { name: \"John Doe\" } satisfies IAuthor.ICreate,\n});\n\nconst book = await api.functional.books.create(connection, {\n body: {\n title: \"My Book\",\n authorId: author.id, // Valid reference\n publisherId: publisher.id // Ensure publisher was created earlier\n } satisfies IBook.ICreate,\n});\n```\n\n**2. Respect Quantity and Limit Constraints**\n```typescript\n// \u2705 CORRECT: Check inventory before ordering\nconst product = await api.functional.products.at(connection, { id: productId });\ntypia.assert(product);\n\nTestValidator.predicate(\n \"sufficient inventory exists\",\n product.inventory >= orderQuantity\n);\n\nconst order = await api.functional.orders.create(connection, {\n body: {\n productId: product.id,\n quantity: orderQuantity\n } satisfies IOrder.ICreate,\n});\n```\n\n**3. Handle State Transitions Properly**\n```typescript\n// \u2705 CORRECT: Follow proper workflow states\n// Create draft\nconst article = await api.functional.articles.create(connection, {\n body: {\n title: \"Draft Article\",\n content: \"Initial content\",\n status: \"draft\"\n } satisfies IArticle.ICreate,\n});\n\n// Review (only drafts can be reviewed)\nconst reviewed = await api.functional.articles.review(connection, {\n id: article.id,\n body: { approved: true } satisfies IArticle.IReview,\n});\n\n// Publish (only reviewed articles can be published)\nconst published = await api.functional.articles.publish(connection, {\n id: article.id,\n});\n```\n\n### 4.6.4. Error Scenario Patterns\n\n**1. Test Logical Business Rule Violations**\n```typescript\n// \u2705 CORRECT: Test business rule enforcement\n// Cannot withdraw more than account balance\nconst account = await api.functional.accounts.at(connection, { id: accountId });\ntypia.assert(account);\n\nawait TestValidator.error(\n \"cannot withdraw more than balance\",\n async () => {\n await api.functional.accounts.withdraw(connection, {\n id: account.id,\n body: {\n amount: account.balance + 1000 // Exceeds balance\n } satisfies IWithdrawal.ICreate,\n });\n },\n);\n```\n\n**2. Test Permission Boundaries**\n```typescript\n// \u2705 CORRECT: Test access control\n// Regular user cannot access admin endpoints\nawait api.functional.users.authenticate.login(connection, {\n body: { email: regularUser.email, password: \"password\" } satisfies IUser.ILogin,\n});\n\nawait TestValidator.error(\n \"regular user cannot access admin data\",\n async () => {\n await api.functional.admin.users.index(connection);\n },\n);\n```\n\n### 4.6.5. Best Practices Summary\n\n1. **Always follow the natural business flow**: Don't skip steps or create impossible scenarios\n2. **Respect data relationships**: Ensure parent-child, ownership, and reference relationships are valid\n3. **Consider timing and state**: Operations should happen in logical order respecting state machines\n4. **Validate prerequisites**: Check that required conditions are met before performing actions\n5. **Test both success and failure paths**: But ensure failure scenarios are logically possible\n6. **Maintain data consistency**: Don't create orphaned records or broken references\n7. **Use realistic test data**: Random data should still make business sense\n\n## 4.7. AI-Driven Autonomous TypeScript Syntax Deep Analysis\n\n### 4.7.1. Autonomous TypeScript Syntax Review Mission\n\n**YOUR MISSION**: Beyond generating functional test code, you must autonomously conduct a comprehensive TypeScript syntax review. Leverage your deep understanding of TypeScript to proactively write code that demonstrates TypeScript mastery and avoids common pitfalls.\n\n**Core Autonomous Review Areas:**\n\n1. **Type Safety Maximization**\n - Never use implicit `any` types\n - Provide explicit type annotations where beneficial\n - Anticipate and prevent potential runtime type errors\n\n2. **TypeScript Best Practices Enforcement**\n - Always use const assertions for literal arrays with RandomGenerator.pick\n - Ensure proper generic type parameters for all typia.random() calls\n - Apply correct type imports and exports patterns\n\n3. **Advanced TypeScript Feature Utilization**\n - Use conditional types where they improve code clarity\n - Apply template literal types for string patterns\n - Leverage mapped types for consistent object transformations\n\n### 4.7.2. Proactive TypeScript Pattern Excellence\n\n**Write code that demonstrates these TypeScript best practices from the start:**\n\n```typescript\n// EXCELLENT: Type-safe array with const assertion\nconst roles = [\"admin\", \"user\", \"guest\"] as const;\nconst selectedRole = RandomGenerator.pick(roles);\n\n// EXCELLENT: Explicit generic types for typia.random\nconst userId = typia.random<string & tags.Format<\"uuid\">>();\nconst age = typia.random<number & tags.Type<\"uint32\"> & tags.Minimum<18> & tags.Maximum<100>>();\n\n// EXCELLENT: Proper null/undefined handling\nconst maybeValue: string | null | undefined = await getOptionalData();\nif (maybeValue !== null && maybeValue !== undefined) {\n const value: string = maybeValue; // Safe narrowing\n TestValidator.equals(\"value check\", value, expectedValue);\n}\n\n// EXCELLENT: Type-safe API response handling\nconst response: IUser.IProfile = await api.functional.users.profile.get(connection, { id });\ntypia.assert(response); // Runtime validation\n```\n\n### 4.7.3. TypeScript Anti-Patterns to Avoid\n\n**Never write code with these common TypeScript mistakes:**\n\n```typescript\n// \u274C NEVER: Implicit any in callbacks\nitems.map(item => item.value); // item is implicitly any\n\n// \u274C NEVER: Type assertions instead of proper validation\nconst data = apiResponse as UserData; // Dangerous assumption\n\n// \u274C NEVER: Missing return type annotations\nasync function processData(input) { // Missing types!\n return someOperation(input);\n}\n\n// \u274C NEVER: Non-null assertion operator\nconst value = possiblyNull!; // Runtime error waiting to happen\n```\n\n## 4.8. CRITICAL: AI Must Generate TypeScript Code, NOT Markdown Documents\n\n**\uD83D\uDEA8 CRITICAL: AI must generate TypeScript code directly, NOT markdown documents with code blocks \uD83D\uDEA8**\n\n**The Core Problem:** When asked to generate TypeScript test code, AI often produces a Markdown document (.md file) containing code blocks, instead of pure TypeScript code.\n\n**What AI Does Wrong:**\n```\n\u274C AI generates this (a markdown document):\n\n# E2E Test Implementation\n\n## Overview\nThis test validates the user registration...\n\n## Implementation\n\n```typescript\nexport async function test_user_auth(connection: api.IConnection): Promise<void> {\n const user = await api.functional.users.register(connection, {...});\n // ... more code ...\n}\n```\n\n## Expected Results\n- User registration should succeed\n- Auth should return token\n```\n\n**What AI Should Generate:**\n```typescript\n\u2705 AI should generate this (pure TypeScript):\n\nexport async function test_user_auth(connection: api.IConnection): Promise<void> {\n const user = await api.functional.users.register(connection, {...});\n // ... more code ...\n}\n```\n\n**CRITICAL RULES:**\n1. **Generate TypeScript code DIRECTLY** - Not a markdown document\n2. **START with `export async function`** - Not with `# Title` or any text\n3. **NO markdown headers** (#, ##, ###) anywhere\n4. **NO code blocks** (```) - The entire output IS the code\n5. **Generate ONLY what goes in a .ts file** - Nothing else\n\n**Detection - If you see yourself writing these, STOP:**\n- `# ` (markdown headers)\n- ``` (code block markers)\n- Sections like \"## Overview\", \"## Implementation\"\n- Any non-TypeScript content\n\n**REMEMBER**: You are generating the CONTENT of a .ts file, not a .md file. Every single character must be valid TypeScript.\n\n## 5. Final Checklist\n\nBefore submitting your generated E2E test code, verify:\n\n**Import and Template Compliance - ZERO TOLERANCE:**\n- [ ] **NO additional import statements** - Using ONLY the imports provided in template\n- [ ] **NO require() statements** - Not attempting any dynamic imports\n- [ ] **NO creative import syntax** - Not trying to bypass import restrictions\n- [ ] **Template code untouched** - Only replaced the `// <E2E TEST CODE HERE>` comment\n- [ ] **All functionality implemented** using only template-provided imports\n\n**Function Structure:**\n- [ ] Function follows the correct naming convention\n- [ ] Function has exactly one parameter: `connection: api.IConnection`\n- [ ] No external functions are defined outside the main function\n- [ ] **CRITICAL**: All TestValidator functions include descriptive title as first parameter\n- [ ] All TestValidator functions use proper positional parameter syntax\n\n**\uD83D\uDEA8 CRITICAL AWAIT CHECKLIST - VERIFY EVERY LINE \uD83D\uDEA8**\n- [ ] **EVERY `api.functional.*` call has `await`** - Check EVERY SINGLE ONE\n- [ ] **TestValidator.error with async callback has `await`** - Both on TestValidator AND inside callback\n- [ ] **No bare Promise assignments** - Always `const x = await ...` not `const x = ...`\n- [ ] **All async operations inside loops have `await`** - for/while/forEach loops\n- [ ] **All async operations inside conditionals have `await`** - if/else/switch statements\n- [ ] **Return statements with async calls have `await`** - `return await api.functional...`\n- [ ] **Promise.all() calls have `await`** - `await Promise.all([...])`\n\n**API Integration:**\n- [ ] All API calls use proper parameter structure and type safety\n- [ ] API function calling follows the exact SDK pattern from provided materials\n- [ ] **DTO type precision** - Using correct DTO variant for each operation (e.g., ICreate for POST, IUpdate for PUT, base type for GET)\n- [ ] **No DTO type confusion** - Never mixing IUser with IUser.ISummary or IOrder with IOrder.ICreate\n- [ ] Path parameters and request body are correctly structured in the second parameter\n- [ ] All API responses are properly validated with `typia.assert()`\n- [ ] Authentication is handled correctly without manual token management\n- [ ] Only actual authentication APIs are used (no helper functions)\n- [ ] **CRITICAL**: NEVER directly assign `connection.headers.Authorization` - let SDK manage it\n\n**Business Logic:**\n- [ ] Test follows a logical, realistic business workflow\n- [ ] Complete user journey from authentication to final validation\n- [ ] Proper data dependencies and setup procedures\n- [ ] Edge cases and error conditions are appropriately tested\n- [ ] Only implementable functionality is included (unimplementable parts are omitted)\n- [ ] **No illogical patterns**: All test scenarios respect business rules and data relationships\n\n**Code Quality:**\n- [ ] Random data generation uses appropriate constraints and formats\n- [ ] **CRITICAL**: All TestValidator functions include descriptive title as FIRST parameter\n- [ ] All TestValidator assertions use actual-first, expected-second pattern (after title)\n- [ ] Code includes comprehensive documentation and comments\n- [ ] Variable naming is descriptive and follows business context\n- [ ] Simple error validation only (no complex error message checking)\n- [ ] **CRITICAL**: For TestValidator.error(), use `await` ONLY with async callbacks\n\n**Type Safety & Code Quality:**\n- [ ] **CRITICAL**: Only API functions and DTOs from the provided materials are used (not from examples)\n- [ ] **CRITICAL**: No fictional functions or types from examples are used\n- [ ] **CRITICAL**: No type safety violations (`any`, `@ts-ignore`, `@ts-expect-error`)\n- [ ] **CRITICAL**: All TestValidator functions include title as first parameter and use correct positional parameter syntax\n- [ ] Follows proper TypeScript conventions and type safety practices\n\n**Performance & Security:**\n- [ ] Efficient resource usage and proper cleanup where necessary\n- [ ] Secure test data generation practices\n- [ ] No hardcoded sensitive information in test data\n\n**Logical Consistency:**\n- [ ] No authentication role mixing without proper context switching\n- [ ] No operations on deleted or non-existent resources\n- [ ] All business rule constraints are respected\n- [ ] No circular dependencies in data creation\n- [ ] Proper temporal ordering of events\n- [ ] Maintained referential integrity\n- [ ] Realistic error scenarios that could actually occur\n\n**Deep TypeScript Syntax Analysis - MANDATORY:**\n- [ ] **Type Safety Excellence**: No implicit any types, all functions have explicit return types\n- [ ] **Const Assertions**: All literal arrays for RandomGenerator.pick use `as const`\n- [ ] **Generic Type Parameters**: All typia.random() calls include explicit type arguments\n- [ ] **Null/Undefined Handling**: All nullable types properly validated before use\n- [ ] **No Type Assertions**: Never use `as Type` - always use proper validation\n- [ ] **No Non-null Assertions**: Never use `!` operator - handle nulls explicitly\n- [ ] **Complete Type Annotations**: All parameters and variables have appropriate types\n- [ ] **Modern TypeScript Features**: Leverage advanced features where they improve code quality\n\n**Markdown Contamination Prevention - CRITICAL:**\n- [ ] **NO Markdown Syntax**: Zero markdown headers, code blocks, or formatting\n- [ ] **NO Documentation Strings**: No template literals containing documentation\n- [ ] **NO Code Blocks in Comments**: Comments contain only plain text\n- [ ] **ONLY Executable Code**: Every line is valid, compilable TypeScript\n- [ ] **Output is TypeScript, NOT Markdown**: Generated output is pure .ts file content, not a .md document with code blocks\n\nGenerate your E2E test code following these guidelines to ensure comprehensive, maintainable, and reliable API testing with exceptional TypeScript quality.\n\n**REMEMBER THE MOST CRITICAL RULE**: You will receive a template with imports. Use ONLY those imports. Add NO new imports. This is absolute and non-negotiable." /* AutoBeSystemPromptConstant.TEST_WRITE */.replace("{{AutoBeTestScenario}}", JSON.stringify({
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
endpoint: {
|
|
32
|
+
description: "The API endpoint being tested.\n\nContains the complete endpoint specification including URL, method,\nparameters, and expected responses that will be validated by this test\nscenario.",
|
|
33
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
34
|
+
},
|
|
35
|
+
draft: {
|
|
36
|
+
description: "A detailed natural language description of how this API endpoint should be\ntested. This should include both successful and failure scenarios, business\nrule validations, edge cases, and any sequence of steps necessary to\nperform the test. A subsequent agent will use this draft to generate\nmultiple concrete test cases.",
|
|
37
|
+
type: "string"
|
|
78
38
|
},
|
|
79
|
-
|
|
80
|
-
"path",
|
|
81
|
-
"
|
|
82
|
-
|
|
39
|
+
functionName: {
|
|
40
|
+
description: "Name of the function being tested.\n\nThe identifier of the API function that this test case targets, used for\norganizing and tracking test results.\n\nNOTE: This uses the same special naming convention as provider functions:\nHTTP method + path segments joined by double underscores. Path parameters\nare prefixed with $.\n\nThis does NOT follow camelCase convention due to its special format:\n\n- HTTP method in lowercase\n- Double underscores (__) as segment separator\n- Path segments separated by single underscores (_)\n- Path parameters prefixed with dollar sign ($)\n\nPattern: method__segment1_segment2_$param Example: \"get__users_$userId\",\n\"post__orders\", \"delete__items_$itemId\"",
|
|
41
|
+
type: "string",
|
|
42
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
43
|
+
},
|
|
44
|
+
dependencies: {
|
|
45
|
+
description: "Functions that must be called before running the main test.\n\nDependencies required to set up test data, authenticate users, create\nresources, or establish other conditions needed for the test to execute\nsuccessfully.",
|
|
46
|
+
type: "array",
|
|
47
|
+
items: {
|
|
48
|
+
$ref: "#/$defs/AutoBeTestScenarioDependency"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
83
51
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
52
|
+
required: [
|
|
53
|
+
"endpoint",
|
|
54
|
+
"draft",
|
|
55
|
+
"functionName",
|
|
56
|
+
"dependencies"
|
|
57
|
+
],
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
$defs: {
|
|
60
|
+
"AutoBeOpenApi.IEndpoint": {
|
|
61
|
+
description: "API endpoint information.",
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
path: {
|
|
65
|
+
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.\n\nPath validation rules:\n\n- Must start with a forward slash (/)\n- Can contain only: letters (a-z, A-Z), numbers (0-9), forward slashes (/),\n curly braces for parameters ({paramName}), hyphens (-), and underscores\n (_)\n- Parameters must be enclosed in curly braces: {paramName}\n- Resource names should be in camelCase\n- No quotes, spaces, or invalid special characters allowed\n- No domain or role-based prefixes\n\nValid examples:\n\n- \"/users\"\n- \"/users/{userId}\"\n- \"/articles/{articleId}/comments\"\n- \"/attachmentFiles\"\n- \"/orders/{orderId}/items/{itemId}\"\n\nInvalid examples:\n\n- \"'/users'\" (contains quotes)\n- \"/user profile\" (contains space)\n- \"/users/[userId]\" (wrong bracket format)\n- \"/admin/users\" (role prefix)\n- \"/api/v1/users\" (API prefix)",
|
|
66
|
+
type: "string",
|
|
67
|
+
pattern: "^\\/[a-zA-Z0-9\\/_{}.-]*$"
|
|
68
|
+
},
|
|
69
|
+
method: {
|
|
70
|
+
description: "HTTP method of the API operation.\n\n**IMPORTANT**: Methods must be written in lowercase only (e.g., \"get\",\nnot \"GET\").\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
71
|
+
oneOf: [
|
|
72
|
+
{
|
|
73
|
+
"const": "get"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"const": "post"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"const": "put"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"const": "delete"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"const": "patch"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
91
89
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
required: [
|
|
91
|
+
"path",
|
|
92
|
+
"method"
|
|
93
|
+
]
|
|
96
94
|
},
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
95
|
+
AutoBeTestScenarioDependency: {
|
|
96
|
+
description: "A dependency function that must be called before the main test.\n\nRepresents a prerequisite API call needed to prepare the system state for\nsuccessful test execution.",
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
purpose: {
|
|
100
|
+
description: "Why this dependency is needed.\n\nExplains the role of this prerequisite function in setting up the\nconditions required for the main test to succeed.",
|
|
101
|
+
type: "string"
|
|
102
|
+
},
|
|
103
|
+
endpoint: {
|
|
104
|
+
description: "The API endpoint for this dependency function.\n\nComplete specification of the prerequisite function that needs to be\ncalled, including parameters and expected behavior.",
|
|
105
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
required: [
|
|
109
|
+
"purpose",
|
|
110
|
+
"endpoint"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
101
113
|
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
text: utils_1.StringUtil.trim `
|
|
114
|
+
})),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: (0, uuid_1.v7)(),
|
|
118
|
+
created_at: new Date().toISOString(),
|
|
119
|
+
type: "assistantMessage",
|
|
120
|
+
text: utils_1.StringUtil.trim `
|
|
110
121
|
Here is the list of input material composition.
|
|
111
122
|
|
|
112
123
|
Make e2e test functions based on the following information.
|
|
113
124
|
|
|
125
|
+
## Function Name
|
|
126
|
+
|
|
127
|
+
The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
|
|
128
|
+
|
|
114
129
|
## Scenario Plan
|
|
115
130
|
|
|
116
131
|
Here is the scenario plan what you have to implement.
|
|
@@ -142,9 +157,35 @@ function transformTestWriteHistories(scenario, artifacts) {
|
|
|
142
157
|
\`\`\`json
|
|
143
158
|
${JSON.stringify(artifacts.e2e)}
|
|
144
159
|
\`\`\`
|
|
160
|
+
|
|
161
|
+
## External Definitions
|
|
162
|
+
|
|
163
|
+
Here is the external declaration files (d.ts) you can reference.
|
|
164
|
+
|
|
165
|
+
\`\`\`json
|
|
166
|
+
${JSON.stringify(yield (0, getTestExternalDeclarations_1.getTestExternalDeclarations)(ctx))}
|
|
167
|
+
\`\`\`
|
|
168
|
+
|
|
169
|
+
## Template Code
|
|
170
|
+
|
|
171
|
+
Here is the template e2e test code what you must follow.
|
|
172
|
+
|
|
173
|
+
You're only allowed to modify the "<SCENARIO DESCRIPTION HERE>" and
|
|
174
|
+
code inside the function block marked as "// <E2E TEST CODE HERE>".
|
|
175
|
+
Change the template code by writing your scenario description to the
|
|
176
|
+
comment, and filling your implementation logic into the function.
|
|
177
|
+
|
|
178
|
+
Note that, you don't need to add any "import" statement more than
|
|
179
|
+
this template code. Everything you need is already imported, so
|
|
180
|
+
make your implementation code in the import scope.
|
|
181
|
+
|
|
182
|
+
\`\`\`typescript
|
|
183
|
+
${artifacts.template}
|
|
184
|
+
\`\`\`
|
|
145
185
|
`,
|
|
146
|
-
|
|
147
|
-
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
});
|
|
148
189
|
}
|
|
149
190
|
(function (transformTestWriteHistories) {
|
|
150
191
|
function structures(artifacts) {
|