mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 07:06:36 +08:00
fix(frontend): correct Pages deployment files route
Align the Pages deployment file-list request with the backend route and add a regression test.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import {beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
import type {AxiosResponse} from 'axios';
|
||||
|
||||
import apiClient from '@/lib/services/core/api-client';
|
||||
import {PagesService} from '@/lib/services/openflare/pages.service';
|
||||
|
||||
vi.mock('@/lib/services/core/api-client', () => ({
|
||||
default: {
|
||||
get: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
describe('PagesService', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(apiClient.get).mockReset();
|
||||
});
|
||||
|
||||
it('requests deployment files using the backend deployment route', async () => {
|
||||
vi.mocked(apiClient.get).mockResolvedValue({
|
||||
data: {error_msg: '', data: []},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {},
|
||||
config: {headers: {}},
|
||||
} as AxiosResponse);
|
||||
|
||||
await PagesService.listDeploymentFiles(7);
|
||||
|
||||
expect(apiClient.get).toHaveBeenCalledWith(
|
||||
'/api/v1/d/pages/deployments/7/files',
|
||||
expect.objectContaining({params: undefined}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user