test(auth): add unit tests for KYC presigned upload and submit handlers

Cover GenerateKycUploadUrlsHandler (10 tests) and SubmitKycHandler (10 tests):
presigned URL flow, legacy file upload, status validation, error handling.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 13:19:44 +07:00
parent 5810f0be56
commit 57db3fe388
9 changed files with 559 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ const GetMacroDataSchema = {
};
export function createReportsServer(deps: ReportsDeps): McpServer {
const baseUrl = deps.aiServiceBaseUrl.replace(/\/$/, '');
const baseUrl = deps.apiBaseUrl.replace(/\/$/, '');
const server = new McpServer({
name: 'goodgo-reports',
@@ -108,15 +108,15 @@ export function createReportsServer(deps: ReportsDeps): McpServer {
'Retrieve macro-economic data (GDP, population, FDI, infrastructure) for a Vietnamese province.',
GetMacroDataSchema,
async (params: z.infer<z.ZodObject<typeof GetMacroDataSchema>>) => {
const response = await fetch(`${baseUrl}/reports/macro-data`, {
method: 'POST',
const qs = new URLSearchParams();
qs.set('province', params.province);
for (const cat of params.categories) qs.append('categories', cat);
qs.set('fromYear', String(params.fromYear));
qs.set('toYear', String(params.toYear));
const response = await fetch(`${baseUrl}/reports/macro-data?${qs.toString()}`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
province: params.province,
categories: params.categories,
from_year: params.fromYear,
to_year: params.toYear,
}),
});
if (!response.ok) {