diff --git a/tests/inspect.rest b/tests/inspect.rest new file mode 100644 index 0000000..6e24e74 --- /dev/null +++ b/tests/inspect.rest @@ -0,0 +1,145 @@ +### Banatie API Testing - VS Code REST Client +### Base URL +@baseUrl = http://localhost:3000 + +### +# Health Check - Basic server status +GET {{baseUrl}}/health + +### +# API Information - Get API details and configuration +GET {{baseUrl}}/api/info + +### +# Generate Image - Basic text prompt only +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="prompt" + +A beautiful sunset over mountains with orange and purple sky +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Generate Image - With custom filename +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="prompt" + +A magical forest with glowing mushrooms and fireflies +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="filename" + +magical_forest_scene +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Generate Image - Add old-school motor plane to magical forest +# Using existing magical_forest_scene.png as reference +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="prompt" + +Add a vintage old-school motor plane flying through this magical forest scene with glowing mushrooms. The plane should have a classic 1920s biplane design with wooden propeller and canvas wings, flying low among the trees with magical sparkles trailing behind it. +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="filename" + +magical_forest_with_vintage_plane +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="referenceImages"; filename="magical_forest_scene.png" +Content-Type: image/png + +< ./results/magical_forest_scene.png +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Generate Image - Multiple reference images +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="prompt" + +Combine elements from these reference images into a futuristic cityscape +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="filename" + +futuristic_city_combo +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="referenceImages"; filename="ref1.jpg" +Content-Type: image/jpeg + +< ./ref1.jpg +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="referenceImages"; filename="ref2.png" +Content-Type: image/png + +< ./ref2.png +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Error Test - Missing prompt (should return 400) +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="filename" + +test_without_prompt +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Error Test - Empty prompt (should return 400) +POST {{baseUrl}}/api/generate +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW + +------WebKitFormBoundary7MA4YWxkTrZu0gW +Content-Disposition: form-data; name="prompt" + + +------WebKitFormBoundary7MA4YWxkTrZu0gW-- + +### +# Test - Non-existent endpoint (should return 404) +GET {{baseUrl}}/api/nonexistent + +### +# Test - Invalid HTTP method on generate endpoint (should return 405) +GET {{baseUrl}}/api/generate + +### +### Instructions for Testing: +### +### 1. Make sure your Banatie server is running on localhost:3000 +### Run: pnpm dev +### +### 2. For requests with reference images, create sample image files: +### - ./reference.jpg +### - ./ref1.jpg +### - ./ref2.png +### Or update the file paths to point to existing images +### +### 3. Install VS Code REST Client extension if not already installed +### +### 4. Click "Send Request" above each ### separator to execute requests +### +### 5. Check the results/ directory for generated images +### +### 6. Expected responses: +### - Health check: JSON with status, uptime, etc. +### - API info: JSON with endpoints and limits +### - Generate (success): JSON with filename, filepath, description +### - Generate (error): JSON with error details and status code +### +### 7. Common test scenarios: +### - Basic text-to-image generation +### - Custom filename specification +### - Single reference image +### - Multiple reference images (up to 3) +### - Error handling (missing prompt, invalid files) +### \ No newline at end of file