feat: support WPS report material workbooks
This commit is contained in:
@@ -17,13 +17,19 @@ vi.mock('@/api/adminApi', () => ({ adminApi }));
|
||||
describe('ReportMaterialImportModal mapping profile action', () => {
|
||||
beforeEach(() => {
|
||||
Object.values(adminApi).forEach((method) => method.mockReset());
|
||||
adminApi.listTenantOptions.mockResolvedValue([{ id: 'tenant-1', name: '测试企业', code: 'T001', status: 'active' }]);
|
||||
adminApi.listEnterpriseApplicationOptions.mockResolvedValue([]);
|
||||
adminApi.listTenantOptions.mockResolvedValue([
|
||||
{ id: 'tenant-1', name: '测试企业', code: 'T001', status: 'active' },
|
||||
]);
|
||||
adminApi.listEnterpriseApplicationOptions.mockResolvedValue([
|
||||
{ id: 'app-1', tenantId: 'tenant-1', name: '测试应用', status: 'active' },
|
||||
]);
|
||||
adminApi.listDrainageFields.mockResolvedValue([]);
|
||||
adminApi.listReportImportProfiles.mockResolvedValue([]);
|
||||
adminApi.analyzeReportMaterialImport.mockResolvedValue({
|
||||
id: 'analysis-1',
|
||||
columns: [{ sourceColumnIndex: 0, columnLetter: 'A', sourceHeader: '签名', sourceHeaderPath: '签名', imageCount: 0 }],
|
||||
columns: [
|
||||
{ sourceColumnIndex: 0, columnLetter: 'A', sourceHeader: '签名', sourceHeaderPath: '签名', imageCount: 0 },
|
||||
],
|
||||
rows: [],
|
||||
suggestedMappings: [],
|
||||
});
|
||||
@@ -37,6 +43,9 @@ describe('ReportMaterialImportModal mapping profile action', () => {
|
||||
expect(tenantSelect).not.toBeNull();
|
||||
await user.click(tenantSelect!);
|
||||
await user.click(screen.getByRole('option', { name: /测试企业/ }));
|
||||
const applicationSelect = screen.getByText('企业应用(必选)').closest('label')?.querySelector('button');
|
||||
await user.click(applicationSelect!);
|
||||
await user.click(screen.getByRole('option', { name: '测试应用' }));
|
||||
const fileInput = document.querySelector('input[type="file"]');
|
||||
expect(fileInput).not.toBeNull();
|
||||
fireEvent.change(fileInput!, { target: { files: [new File(['xlsx'], 'mapping.xlsx')] } });
|
||||
@@ -46,7 +55,9 @@ describe('ReportMaterialImportModal mapping profile action', () => {
|
||||
expect(toggle).toHaveClass('ui-button', 'report-import-profile__toggle');
|
||||
expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||||
await user.click(toggle);
|
||||
await waitFor(() => expect(screen.getByRole('button', { name: '本次将保存/更新映射方案' })).toHaveAttribute('aria-pressed', 'true'));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole('button', { name: '本次将保存/更新映射方案' })).toHaveAttribute('aria-pressed', 'true'),
|
||||
);
|
||||
expect(screen.getByLabelText('映射方案名称')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user