feat: Scheduled Maintenance feature complete
This commit is contained in:
@@ -25,35 +25,35 @@ Object.defineProperty(global.URL, 'revokeObjectURL', {
|
||||
describe('DocumentPreview', () => {
|
||||
const mockPdfDocument: DocumentRecord = {
|
||||
id: 'doc-1',
|
||||
user_id: 'user-1',
|
||||
vehicle_id: 'vehicle-1',
|
||||
document_type: 'insurance',
|
||||
userId: 'user-1',
|
||||
vehicleId: 'vehicle-1',
|
||||
documentType: 'insurance',
|
||||
title: 'Insurance Document',
|
||||
content_type: 'application/pdf',
|
||||
created_at: '2024-01-01T00:00:00Z',
|
||||
updated_at: '2024-01-01T00:00:00Z',
|
||||
contentType: 'application/pdf',
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
|
||||
const mockImageDocument: DocumentRecord = {
|
||||
id: 'doc-2',
|
||||
user_id: 'user-1',
|
||||
vehicle_id: 'vehicle-1',
|
||||
document_type: 'registration',
|
||||
userId: 'user-1',
|
||||
vehicleId: 'vehicle-1',
|
||||
documentType: 'registration',
|
||||
title: 'Registration Photo',
|
||||
content_type: 'image/jpeg',
|
||||
created_at: '2024-01-01T00:00:00Z',
|
||||
updated_at: '2024-01-01T00:00:00Z',
|
||||
contentType: 'image/jpeg',
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
|
||||
const mockNonPreviewableDocument: DocumentRecord = {
|
||||
id: 'doc-3',
|
||||
user_id: 'user-1',
|
||||
vehicle_id: 'vehicle-1',
|
||||
document_type: 'insurance',
|
||||
userId: 'user-1',
|
||||
vehicleId: 'vehicle-1',
|
||||
documentType: 'insurance',
|
||||
title: 'Text Document',
|
||||
content_type: 'text/plain',
|
||||
created_at: '2024-01-01T00:00:00Z',
|
||||
updated_at: '2024-01-01T00:00:00Z',
|
||||
contentType: 'text/plain',
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -27,21 +27,21 @@ describe('DocumentsMobileScreen', () => {
|
||||
const mockDocuments: DocumentRecord[] = [
|
||||
{
|
||||
id: 'doc-1',
|
||||
user_id: 'user-1',
|
||||
vehicle_id: 'vehicle-1',
|
||||
document_type: 'insurance',
|
||||
userId: 'user-1',
|
||||
vehicleId: 'vehicle-1',
|
||||
documentType: 'insurance',
|
||||
title: 'Car Insurance',
|
||||
created_at: '2024-01-01T00:00:00Z',
|
||||
updated_at: '2024-01-01T00:00:00Z',
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
},
|
||||
{
|
||||
id: 'doc-2',
|
||||
user_id: 'user-1',
|
||||
vehicle_id: 'vehicle-2',
|
||||
document_type: 'registration',
|
||||
userId: 'user-1',
|
||||
vehicleId: 'vehicle-2',
|
||||
documentType: 'registration',
|
||||
title: 'Vehicle Registration',
|
||||
created_at: '2024-01-02T00:00:00Z',
|
||||
updated_at: '2024-01-02T00:00:00Z',
|
||||
createdAt: '2024-01-02T00:00:00Z',
|
||||
updatedAt: '2024-01-02T00:00:00Z',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -12,14 +12,7 @@ export const DocumentsMobileScreen: React.FC = () => {
|
||||
console.log('[DocumentsMobileScreen] Component initializing');
|
||||
|
||||
// Auth is managed at App level; keep hook to support session-expired UI.
|
||||
// In test environments without provider, fall back gracefully.
|
||||
let auth = { isAuthenticated: true, isLoading: false, loginWithRedirect: () => {} } as any;
|
||||
try {
|
||||
auth = useAuth0();
|
||||
} catch {
|
||||
// Tests render without Auth0Provider; assume authenticated for unit tests.
|
||||
}
|
||||
|
||||
const auth = useAuth0();
|
||||
const { isAuthenticated, isLoading: authLoading, loginWithRedirect } = auth;
|
||||
|
||||
// Data hooks (unconditional per React rules)
|
||||
|
||||
Reference in New Issue
Block a user