refactor(api): inject server dependencies in tests
This commit is contained in:
+21
-24
@@ -47,15 +47,14 @@ Deno.test('ApiServer serves health metrics and authenticated model listings', as
|
||||
};
|
||||
},
|
||||
} as never,
|
||||
);
|
||||
|
||||
(server as unknown as {
|
||||
gpuDetector: { detectGpus: () => Promise<unknown[]> };
|
||||
}).gpuDetector = {
|
||||
async detectGpus() {
|
||||
return [{ id: 'nvidia-0' }];
|
||||
{
|
||||
gpuDetector: {
|
||||
async detectGpus() {
|
||||
return [{ id: 'nvidia-0' }];
|
||||
},
|
||||
} as never,
|
||||
},
|
||||
};
|
||||
);
|
||||
|
||||
await server.start();
|
||||
|
||||
@@ -142,15 +141,14 @@ Deno.test('ApiServer metrics expose 5xx counts for failing endpoints', async ()
|
||||
};
|
||||
},
|
||||
} as never,
|
||||
);
|
||||
|
||||
(server as unknown as {
|
||||
gpuDetector: { detectGpus: () => Promise<unknown[]> };
|
||||
}).gpuDetector = {
|
||||
async detectGpus() {
|
||||
return [];
|
||||
{
|
||||
gpuDetector: {
|
||||
async detectGpus() {
|
||||
return [];
|
||||
},
|
||||
} as never,
|
||||
},
|
||||
};
|
||||
);
|
||||
|
||||
await server.start();
|
||||
|
||||
@@ -209,15 +207,14 @@ Deno.test('ApiServer enforces api rate limits while exempting health and metrics
|
||||
};
|
||||
},
|
||||
} as never,
|
||||
);
|
||||
|
||||
(server as unknown as {
|
||||
gpuDetector: { detectGpus: () => Promise<unknown[]> };
|
||||
}).gpuDetector = {
|
||||
async detectGpus() {
|
||||
return [];
|
||||
{
|
||||
gpuDetector: {
|
||||
async detectGpus() {
|
||||
return [];
|
||||
},
|
||||
} as never,
|
||||
},
|
||||
};
|
||||
);
|
||||
|
||||
await server.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user