update minio coverage cronjobb
Backend SonarQube Check testing / sonar-check (push) Failing after 5m56s
Details
Backend SonarQube Check testing / sonar-check (push) Failing after 5m56s
Details
This commit is contained in:
parent
7f4350fba8
commit
223a30f416
|
|
@ -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 {
|
||||
PrismaClient: jest.fn(() => ({
|
||||
aINotification: {
|
||||
findMany: jest.fn().mockResolvedValue([]),
|
||||
},
|
||||
campaign: {
|
||||
findMany: jest.fn().mockResolvedValue([]),
|
||||
},
|
||||
$connect: jest.fn(),
|
||||
$disconnect: jest.fn(),
|
||||
})),
|
||||
};
|
||||
});
|
||||
// MOCK PREFIX (ESM)
|
||||
jest.mock('../app/static/prefix.js', () => ({
|
||||
default: {},
|
||||
}));
|
||||
|
||||
test('load backend without crashing', () => {
|
||||
// MOCK PRISMA
|
||||
jest.mock('@prisma/client', () => ({
|
||||
PrismaClient: jest.fn(() => ({
|
||||
aINotification: { findMany: jest.fn().mockResolvedValue([]) },
|
||||
campaign: { findMany: jest.fn().mockResolvedValue([]) },
|
||||
$connect: jest.fn(),
|
||||
$disconnect: jest.fn(),
|
||||
})),
|
||||
}));
|
||||
|
||||
test('backend load without open handles', () => {
|
||||
require('../index');
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue