refactor: update cron message to be consistent

This commit is contained in:
Ravinou 2025-04-20 21:42:54 +02:00
commit afe828fc1a
No known key found for this signature in database
GPG key ID: EEEE670C40F6A4D7
4 changed files with 7 additions and 6 deletions

View file

@ -152,7 +152,7 @@ describe('Cronjob API Handler', () => {
expect(res._getStatusCode()).toBe(200);
expect(res._getJSONData()).toEqual({
status: 200,
message: 'Status cron executed successfully.',
message: 'Status cron executed successfully',
});
expect(ConfigService.updateRepoList).toHaveBeenCalled();
});

View file

@ -96,7 +96,7 @@ export default async function handler(
}
await ConfigService.updateRepoList(updatedRepoList);
return ApiResponse.success(res, 'Status cron executed successfully.');
return ApiResponse.success(res, 'Status cron executed successfully');
} catch (error) {
console.log(error);
if (error instanceof Error && error.message === 'The check status service is already running') {

View file

@ -1,6 +1,7 @@
import handler from '~/pages/api/v1/cron/storage';
import { createMocks } from 'node-mocks-http';
import { ConfigService, ShellService } from '~/services';
import { Repository } from '~/types';
vi.mock('~/services');
@ -56,7 +57,7 @@ describe('GET /api/cronjob/getStorageUsed', () => {
const mockRepoList = [
{ repositoryName: 'repo1', storageUsed: 0 },
{ repositoryName: 'repo2', storageUsed: 0 },
];
] as Repository[];
const mockStorageUsed = [
{ name: 'repo1', size: 100 },
{ name: 'repo2', size: 200 },
@ -76,7 +77,7 @@ describe('GET /api/cronjob/getStorageUsed', () => {
await handler(req, res);
expect(res._getStatusCode()).toBe(200);
expect(res._getData()).toContain('Storage cron has been executed');
expect(res._getData()).toContain('Storage cron executed successfully');
expect(ConfigService.updateRepoList).toHaveBeenCalledWith([
{ repositoryName: 'repo1', storageUsed: 100 },
{ repositoryName: 'repo2', storageUsed: 200 },
@ -102,7 +103,7 @@ describe('GET /api/cronjob/getStorageUsed', () => {
const mockRepoList = [
{ repositoryName: 'repo1', storageUsed: 0 },
{ repositoryName: 'repo2', storageUsed: 0 },
];
] as Repository[];
const mockStorageUsed = [{ name: 'repo1', size: 100 }];
vi.mocked(ConfigService.getRepoList).mockResolvedValue(mockRepoList);

View file

@ -38,7 +38,7 @@ export default async function handler(
});
await ConfigService.updateRepoList(updatedRepoList);
return ApiResponse.success(res, 'Storage cron has been executed.');
return ApiResponse.success(res, 'Storage cron executed successfully');
} catch (error) {
console.log(error);
if (error instanceof Error && error.message === 'The storage used service is already running') {