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:
ryan
2026-07-13 09:29:22 +08:00
parent d97581fb1e
commit 439ac41da8
4 changed files with 41 additions and 4 deletions
@@ -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}),
);
});
});