Skip to content

Commit

Permalink
add a test for what it looks like when you remove an import
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Nov 20, 2020
1 parent 621fc0c commit 2c3974f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/golden-results/removed-forbidden.sh.txt
@@ -0,0 +1,4 @@
vendor/elm-spa-example/src/Article/Body.elm: removed forbidden import Html! (Run me with `update` to fix this.)

It looks like you removed some forbidden imports. Good job! To update the config
and remove this error, just run me with the `update` command!
20 changes: 20 additions & 0 deletions tests/integration/removed-forbidden.sh
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

elm-forbid-import add-root vendor/elm-spa-example
elm-forbid-import forbid Html

set +e
MATCH="$(elm-forbid-import --format json check | jq '.[0]')"
set -e

elm-forbid-import update

FILE="$(jq -r '.file' <<< "$MATCH")"
cp "$FILE" "$FILE.bak"
sed -i "$(jq '.position.row' <<< "$MATCH")d" "$FILE"

if elm-forbid-import check; then
exit 1 # this check should exit 1
fi

mv "$FILE.bak" "$FILE"

0 comments on commit 2c3974f

Please sign in to comment.