← Back to Kontasks
Konimage Test Suite Explained
25 tests covering cache, transform, params, and storage
Output
Konimage Test Suite
25 tests + 5 ignored integration tests
cache_test.ts (10 tests)
Tests the image caching layer that stores original PropertyMe images locally.
| getCachePaths | Generates correct file paths for cached images |
| initCache | Creates pmeimages/ and metadata/ directories |
| getCachedOriginal | Returns cache hit/miss status for images |
| cacheOriginal | Stores image buffer + metadata (content-type, etag, etc) |
| readCachedOriginal | Reads cached image as Uint8Array buffer |
| clearListingCache | Removes all images for a specific listing |
| getCacheStats | Returns count and total size of cached images |
transform_test.ts (5 tests)
Tests ImageMagick-based image resizing using a real test JPEG fixture.
| resize to width | Resizes image to specified width (e.g., 500px) |
| JPEG format | Outputs valid JPEG with FF D8...FF D9 markers |
| crop mode | Handles crop to exact dimensions (e.g., 400x400) |
| file size | Smaller dimensions = smaller file size |
| no upscale | Won't scale up small images beyond original size |
params_test.ts (6 tests)
Tests URL parameter parsing and authentication key validation.
| resize mode | Parses ?mode=resize&imageurl=...&key=99 |
| fetch mode | Parses ?mode=fetch (no key required for local) |
| invalid key | Returns A12 error for bad authentication |
| daily key | Validates key = UTC day of month (01-31) |
| ping mode | Health check endpoint parsing |
| arrayresize | Batch resize mode with JSON image array |
store_test.ts (3 tests)
Tests saving processed images to disk with correct naming.
| stores JPEG | Saves to ./images/{uniqueid}-{num}-{width}.jpg |
| rejects invalid | Throws error for corrupted/non-JPEG data |
| creates dir | Auto-creates images/ directory if missing |
integration_test.ts (5 ignored)
Requires live server - tests ping endpoint, fetch existing images, 404 handling, key validation, and resize with bypass key. Run manually with --ignore=none.
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Created
1 Jan 2026, 10:40 pm
Updated
2 Jan 2026, 3:10 pm
Created By
claude
Raw Data
{
"id": "f9c1487e-fc60-4ba2-abb6-9241052fd8d8",
"type": "general",
"status": "completed",
"title": "Konimage Test Suite Explained",
"description": "25 tests covering cache, transform, params, and storage",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:sans-serif;\">\n<h2 style=\"color:#fff;margin:0 0 8px 0;\">Konimage Test Suite</h2>\n<p style=\"color:#7f848e;margin:0 0 20px 0;\">25 tests + 5 ignored integration tests</p>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#98c379;margin:0 0 12px 0;font-size:1rem;\">cache_test.ts <span style=\"color:#7f848e;font-weight:normal;\">(10 tests)</span></h3>\n<p style=\"color:#7f848e;margin:0 0 12px 0;\">Tests the image caching layer that stores original PropertyMe images locally.</p>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.85rem;font-family:monospace;\">\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">getCachePaths</td><td style=\"color:#e0e0e0;\">Generates correct file paths for cached images</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">initCache</td><td style=\"color:#e0e0e0;\">Creates pmeimages/ and metadata/ directories</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">getCachedOriginal</td><td style=\"color:#e0e0e0;\">Returns cache hit/miss status for images</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">cacheOriginal</td><td style=\"color:#e0e0e0;\">Stores image buffer + metadata (content-type, etag, etc)</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">readCachedOriginal</td><td style=\"color:#e0e0e0;\">Reads cached image as Uint8Array buffer</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">clearListingCache</td><td style=\"color:#e0e0e0;\">Removes all images for a specific listing</td></tr>\n<tr><td style=\"padding:6px 0;color:#61afef;\">getCacheStats</td><td style=\"color:#e0e0e0;\">Returns count and total size of cached images</td></tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#e5c07b;margin:0 0 12px 0;font-size:1rem;\">transform_test.ts <span style=\"color:#7f848e;font-weight:normal;\">(5 tests)</span></h3>\n<p style=\"color:#7f848e;margin:0 0 12px 0;\">Tests ImageMagick-based image resizing using a real test JPEG fixture.</p>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.85rem;font-family:monospace;\">\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">resize to width</td><td style=\"color:#e0e0e0;\">Resizes image to specified width (e.g., 500px)</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">JPEG format</td><td style=\"color:#e0e0e0;\">Outputs valid JPEG with FF D8...FF D9 markers</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">crop mode</td><td style=\"color:#e0e0e0;\">Handles crop to exact dimensions (e.g., 400x400)</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">file size</td><td style=\"color:#e0e0e0;\">Smaller dimensions = smaller file size</td></tr>\n<tr><td style=\"padding:6px 0;color:#61afef;\">no upscale</td><td style=\"color:#e0e0e0;\">Won't scale up small images beyond original size</td></tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#c678dd;margin:0 0 12px 0;font-size:1rem;\">params_test.ts <span style=\"color:#7f848e;font-weight:normal;\">(6 tests)</span></h3>\n<p style=\"color:#7f848e;margin:0 0 12px 0;\">Tests URL parameter parsing and authentication key validation.</p>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.85rem;font-family:monospace;\">\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">resize mode</td><td style=\"color:#e0e0e0;\">Parses ?mode=resize&imageurl=...&key=99</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">fetch mode</td><td style=\"color:#e0e0e0;\">Parses ?mode=fetch (no key required for local)</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">invalid key</td><td style=\"color:#e0e0e0;\">Returns A12 error for bad authentication</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">daily key</td><td style=\"color:#e0e0e0;\">Validates key = UTC day of month (01-31)</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">ping mode</td><td style=\"color:#e0e0e0;\">Health check endpoint parsing</td></tr>\n<tr><td style=\"padding:6px 0;color:#61afef;\">arrayresize</td><td style=\"color:#e0e0e0;\">Batch resize mode with JSON image array</td></tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#56b6c2;margin:0 0 12px 0;font-size:1rem;\">store_test.ts <span style=\"color:#7f848e;font-weight:normal;\">(3 tests)</span></h3>\n<p style=\"color:#7f848e;margin:0 0 12px 0;\">Tests saving processed images to disk with correct naming.</p>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.85rem;font-family:monospace;\">\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">stores JPEG</td><td style=\"color:#e0e0e0;\">Saves to ./images/{uniqueid}-{num}-{width}.jpg</td></tr>\n<tr style=\"border-bottom:1px solid #444;\"><td style=\"padding:6px 0;color:#61afef;\">rejects invalid</td><td style=\"color:#e0e0e0;\">Throws error for corrupted/non-JPEG data</td></tr>\n<tr><td style=\"padding:6px 0;color:#61afef;\">creates dir</td><td style=\"color:#e0e0e0;\">Auto-creates images/ directory if missing</td></tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;border-left:4px solid #f97316;\">\n<h3 style=\"color:#f97316;margin:0 0 8px 0;font-size:1rem;\">integration_test.ts <span style=\"color:#7f848e;font-weight:normal;\">(5 ignored)</span></h3>\n<p style=\"margin:0;color:#7f848e;font-size:0.9rem;\">Requires live server - tests ping endpoint, fetch existing images, 404 handling, key validation, and resize with bypass key. Run manually with <code style=\"background:#1a1a1a;padding:2px 6px;border-radius:3px;\">--ignore=none</code>.</p>\n</div>\n</div>",
"requestedAt": "2026-01-01T12:40:00.000Z",
"requestId": "be3ba833-fe48-494d-b784-ed1d35c2b59f"
},
"createdBy": "claude",
"createdAt": "2026-01-01T12:40:10.149Z",
"updatedAt": "2026-01-02T05:10:54.070Z",
"requestId": "be3ba833-fe48-494d-b784-ed1d35c2b59f"
}