hansololai/postgraphile-polymorphic-relation-plugin

View on GitHub
scripts/test

Summary

Maintainability
Test Coverage
#!/bin/bash
set -e

if [ -x ".env" ]; then
  echo "exist"
  set -a
  . ./.env
  set +a
fi;

if [ "$TEST_DATABASE_URL" == "" ]; then
  echo "ERROR: No test database configured; aborting"
  echo
  echo "To resolve this, ensure environmental variable TEST_DATABASE_URL is set"
  exit 1;
fi;

# Import latest schema (throw on error)
psql -Xqv ON_ERROR_STOP=1 -f __tests__/p-schema.sql "$TEST_DATABASE_URL"
echo "Database reset successfully ✅"

# Now run the tests
jest -i $@