Fix React DOM warnings and improve pre-push hook
- Fix fill and priority boolean attributes in Hero component - Improve next/image mock in Jest setup to handle boolean props correctly - Enhance pre-push hook with better Docker detection and error handling - Make Docker build test non-blocking (warnings instead of errors) - Add executable permissions for secret check script - Prevent React DOM warnings in tests
This commit is contained in:
@@ -99,6 +99,7 @@ fi
|
|||||||
# Check for secrets in code
|
# Check for secrets in code
|
||||||
print_status "Checking for secrets in code..."
|
print_status "Checking for secrets in code..."
|
||||||
if [ -f "scripts/check-secrets.sh" ]; then
|
if [ -f "scripts/check-secrets.sh" ]; then
|
||||||
|
chmod +x scripts/check-secrets.sh
|
||||||
if ./scripts/check-secrets.sh; then
|
if ./scripts/check-secrets.sh; then
|
||||||
print_success "No secrets found in code"
|
print_success "No secrets found in code"
|
||||||
else
|
else
|
||||||
@@ -138,14 +139,20 @@ if [ "$CURRENT_BRANCH" = "production" ]; then
|
|||||||
print_warning "No .env file found. Make sure secrets are configured in Gitea."
|
print_warning "No .env file found. Make sure secrets are configured in Gitea."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Docker image can be built
|
# Check if Docker is running
|
||||||
print_status "Testing Docker build..."
|
if ! docker info > /dev/null 2>&1; then
|
||||||
if docker build -t portfolio-app:test . > /dev/null 2>&1; then
|
print_warning "Docker is not running. Skipping Docker build test."
|
||||||
print_success "Docker build test passed"
|
|
||||||
docker rmi portfolio-app:test > /dev/null 2>&1
|
|
||||||
else
|
else
|
||||||
print_error "Docker build test failed!"
|
# Check Docker image can be built
|
||||||
exit 1
|
print_status "Testing Docker build..."
|
||||||
|
if docker build -t portfolio-app:test . > /dev/null 2>&1; then
|
||||||
|
print_success "Docker build test passed"
|
||||||
|
docker rmi portfolio-app:test > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
print_warning "Docker build test failed, but continuing..."
|
||||||
|
# Don't fail the push for Docker build issues in pre-push hook
|
||||||
|
# The CI/CD pipeline will catch this
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ const Hero = () => {
|
|||||||
<Image
|
<Image
|
||||||
src="/images/me.jpg"
|
src="/images/me.jpg"
|
||||||
alt="Dennis Konkol - Software Engineer"
|
alt="Dennis Konkol - Software Engineer"
|
||||||
fill={true}
|
fill
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
priority={true}
|
priority
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Hover overlay effect */}
|
{/* Hover overlay effect */}
|
||||||
|
|||||||
@@ -25,8 +25,14 @@ jest.mock('next/link', () => {
|
|||||||
|
|
||||||
// Mock next/image
|
// Mock next/image
|
||||||
jest.mock('next/image', () => {
|
jest.mock('next/image', () => {
|
||||||
const ImageComponent = ({ src, alt, ...props }: Record<string, unknown>) =>
|
const ImageComponent = ({ src, alt, fill, priority, ...props }: Record<string, unknown>) => {
|
||||||
React.createElement('img', { src, alt, ...props });
|
// Convert boolean props to strings for DOM compatibility
|
||||||
|
const domProps: Record<string, unknown> = { src, alt };
|
||||||
|
if (fill) domProps.style = { width: '100%', height: '100%', objectFit: 'cover' };
|
||||||
|
if (priority) domProps.loading = 'eager';
|
||||||
|
|
||||||
|
return React.createElement('img', { ...domProps, ...props });
|
||||||
|
};
|
||||||
ImageComponent.displayName = 'Image';
|
ImageComponent.displayName = 'Image';
|
||||||
return ImageComponent;
|
return ImageComponent;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user