#!/usr/bin/env bash

ROOT=$(pwd)

FILE_PATH=$1

cd $FILE_PATH

echo "💼 prepare for testing package"

flutter pub get

if [ "$?" != "0" ]; then
    echo >&2 "🚫 Error: Prepare for testing failed";
    exit 1
fi

echo "🔬 testing nut_player package"
flutter test

if [ "$?" != "0" ]; then
    echo >&2 "🚫 Error: Linting Player failed";
    exit 1
fi

#cd example
#
#echo "💼 prepare for testing example"
#
#flutter pub get
#
#if [ "$?" != "0" ]; then
#    echo >&2 "🚫 Error: Prepare for testing failed";
#    exit 1
#fi

#echo "🔬 testing example"
#flutter test
#
#if [ "$?" != "0" ]; then
#    echo >&2 "🚫 Error: Testing example failed";
#    exit 1
#fi

cd $ROOT
