#!/bin/bash

function test() {
    echo "-----------------------------[ TEST ]-----------------------------"
    printf "running $1\n\n"

    eval "$1"
    exit_status=$?

    printf "\n\n"

    if [ ! $exit_status -eq 0 ]; then
        abort "command: $1 failed with: $exit_status"
    fi
}

test "curl -i http://localhost:8080/version"
test "curl -i http://localhost:8080/api/ingredients"
test "curl -i http://localhost:8080/api/recipes"
test "curl -i http://localhost:8080/api/recipe/bread/ingredients
