From b02152f524c6b543041496adb4389a64105d24aa Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 18 Nov 2023 13:10:06 +0100 Subject: [PATCH] install bashunit and test pre-commit hook --- .editorconfig | 3 +++ tools/.gitignore | 1 + tools/README.md | 16 ++++++++++++++++ tools/tests/pre-commit_test.sh | 9 +++++++++ 4 files changed, 29 insertions(+) create mode 100644 tools/.gitignore create mode 100644 tools/README.md create mode 100755 tools/tests/pre-commit_test.sh diff --git a/.editorconfig b/.editorconfig index ed779295..daf5be3e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,6 @@ charset = utf-8 [{*.yml,*.yaml}] indent_size = 2 + +[*.sh] +indent_size = 2 diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 00000000..c3af8579 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +lib/ diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 00000000..36dba8ed --- /dev/null +++ b/tools/README.md @@ -0,0 +1,16 @@ +## Tools + +Here you can find developer tools to improve your DX. + +### Testing + +Install testing library with: +```bash +cd tools +curl -s https://bashunit.typeddevs.com/install.sh | bash -s lib 0.10.1 +``` + +Run bash tests: +```bash +lib/bashunit tests +``` diff --git a/tools/tests/pre-commit_test.sh b/tools/tests/pre-commit_test.sh new file mode 100755 index 00000000..f2d5c6f5 --- /dev/null +++ b/tools/tests/pre-commit_test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function test_pre_commit() { + spy composer + + "$(dirname "${BASH_SOURCE[0]}")"/../git-hooks/pre-commit.sh + + assert_have_been_called_times 2 composer +}