update minio coverage cronjobb
Backend SonarQube Check testing / sonar-check (push) Failing after 5m56s Details

This commit is contained in:
Syifa 2026-01-09 10:36:24 +07:00
parent 7f4350fba8
commit 223a30f416
1 changed files with 28 additions and 21 deletions

View File

@ -1,3 +1,16 @@
// MOCK EXPRESS LISTEN
jest.mock('express', () => {
const original = jest.requireActual('express');
return () => {
const app = original();
app.listen = jest.fn(() => ({
close: jest.fn(),
}));
return app;
};
});
// MOCK CRON
jest.mock('node-cron', () => ({
schedule: jest.fn(() => ({
start: jest.fn(),
@ -5,33 +18,27 @@ jest.mock('node-cron', () => ({
})),
}));
// MOCK PREFIX (ESM)
jest.mock('../app/static/prefix.js', () => ({
default: {},
}));
// MOCK MINIO
jest.mock('minio', () => ({
Client: jest.fn(() => ({})),
}));
// MOCK PRISMA CLIENT (INI KUNCI)
jest.mock('@prisma/client', () => {
return {
// MOCK PREFIX (ESM)
jest.mock('../app/static/prefix.js', () => ({
default: {},
}));
// MOCK PRISMA
jest.mock('@prisma/client', () => ({
PrismaClient: jest.fn(() => ({
aINotification: {
findMany: jest.fn().mockResolvedValue([]),
},
campaign: {
findMany: jest.fn().mockResolvedValue([]),
},
aINotification: { findMany: jest.fn().mockResolvedValue([]) },
campaign: { findMany: jest.fn().mockResolvedValue([]) },
$connect: jest.fn(),
$disconnect: jest.fn(),
})),
};
});
}));
test('load backend without crashing', () => {
test('backend load without open handles', () => {
require('../index');
expect(true).toBe(true);
});