#!/bin/bash
# Test bulk_file_import CLI command
# Usage: ./test_bulk_import.sh [db_path]
# Default: /home/david/go/src/skraak/db/test.duckdb (ALWAYS USE TEST DATABASE!)
# Get absolute paths before changing directory
SCRIPT_DIR=""
PROJECT_DIR=""
DB_PATH=""
if [; then
fi
# Navigate to the project directory where skraak binary is located
||
# Helper to run CLI command and capture JSON output
# Helper to check for error in CLI output
# Create a test dataset using CLI
DATASET_RESULT=
DATASET_ID=
if [; then
else
|
fi
# Create test location A
LOCATION_A_RESULT=
LOCATION_A_ID=
if [; then
else
|
fi
# Create test location B
LOCATION_B_RESULT=
LOCATION_B_ID=
if [; then
else
|
fi
# Create test CSV with sample data
CSV_FILE="/tmp/test_bulk_import_.csv"
LOG_FILE="/tmp/test_bulk_import_.log"
# Note: Directories don't exist, so no files will be imported
# This validates:
# - CSV parsing
# - Location ID validation
# - Cluster auto-creation logic
# - JSON output format
IMPORT_RESULT=
# Extract just the JSON output (last lines starting with {)
JSON_OUTPUT=
# Check for valid JSON output with expected structure
FILES_IMPORTED=
if [; then
else
# Check for error
if | ; then
| |
else
|
fi
fi
# Check if log file was created
if [; then
else
fi
INVALID_CSV=
if | ; then
else
|
fi
INVALID_DATASET=
if | ; then
else
|
fi
MISSING_FLAGS=
if | ; then
else
|
fi
# Cleanup