From aa4572b10f3a1c73b8571ee5cfd6fbcc839d12dd Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Sat, 31 Aug 2024 13:16:51 +1000 Subject: [PATCH] Add test to see that versions only with tag_prefix are returned --- tests/test_version-lookup.bats | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_version-lookup.bats b/tests/test_version-lookup.bats index 57c2932..a614482 100644 --- a/tests/test_version-lookup.bats +++ b/tests/test_version-lookup.bats @@ -116,6 +116,25 @@ function init_repo { [[ "$output" = *"CURRENT_VERSION=1.2.300"* ]] } +@test "finds only prefixed tags when tag_prefix set" { + init_repo + + export tag_prefix="@org/product" + + git tag @org/product@0.1.2 + git tag @org/product@0.1.3-dev.123 + git tag 2.4.5 + git tag 2.4.6-dev.456 + + run version-lookup.sh + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" = *"CURRENT_VERSION=0.1.2"* ]] && + [[ "$output" = *"CURRENT_V_VERSION=v0.1.2"* ]] +} +} + @test "returns 0.0.0 if no normal version detected" { init_repo