Fix data exports UI and scope format
This commit is contained in:
22
resources/js/admin/mobile/lib/dataExports.test.ts
Normal file
22
resources/js/admin/mobile/lib/dataExports.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { hasInProgressExports } from './dataExports';
|
||||
|
||||
describe('dataExports helpers', () => {
|
||||
it('detects in-progress exports', () => {
|
||||
const result = hasInProgressExports([
|
||||
{ id: 1, status: 'pending' } as any,
|
||||
{ id: 2, status: 'ready' } as any,
|
||||
]);
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when exports are terminal', () => {
|
||||
const result = hasInProgressExports([
|
||||
{ id: 1, status: 'ready' } as any,
|
||||
{ id: 2, status: 'failed' } as any,
|
||||
]);
|
||||
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
5
resources/js/admin/mobile/lib/dataExports.ts
Normal file
5
resources/js/admin/mobile/lib/dataExports.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { DataExportSummary } from '../../api';
|
||||
|
||||
export function hasInProgressExports(exports: DataExportSummary[]): boolean {
|
||||
return exports.some((entry) => entry.status === 'pending' || entry.status === 'processing');
|
||||
}
|
||||
Reference in New Issue
Block a user