]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change move tests files into setup
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 10:16:40 +0000 (12:16 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 10:16:40 +0000 (12:16 +0200)
tests/albentohandy.bats

index fdf947c5698d166d5debb7ba5f0bea1c5de01dd7..4adf7027c54a87b1720053892ac7ab62420bfa57 100755 (executable)
@@ -3,8 +3,11 @@
 setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
-       mkdir --parents "build/tests/music"
+       mkdir --parents "build/tests/music/Alben/Artist1"
        echo "Alben/Artist1" > "build/tests/albumlist"
+       echo "testfile" > "build/tests/music/Alben/Artist1/file.flac"
+       echo "cover" > "build/tests/music/Alben/Artist1/cover.jpg"
+       mkdir --parents "build/tests/output"
        export TEST_MODE="ON"
        export CONFIG_FILE="tests/test.conf"
        export LIB_PATH="src/lib"
@@ -126,18 +129,16 @@ teardown() {
        [ -d "build/tests/output" ]
 }
 
-@test "failed: directory build/tests/music/Alben/Artist1 does not exists" {
+@test "failed: directory build/tests/music/Alben/Artist2 does not exists" {
+       echo "Alben/Artist2" > "build/tests/albumlist"
+
        run main -i "build/tests/albumlist"
 
        assert_failure
-       assert_output --partial "build/tests/music/Alben/Artist1 does not exists"
+       assert_output --partial "build/tests/music/Alben/Artist2 does not exists"
 }
 
 @test "success: create symlink for Alben/Artist1/file.flac" {
-       mkdir --parents "build/tests/output"
-       mkdir --parents "build/tests/music/Alben/Artist1"
-       echo "testfile" > "build/tests/music/Alben/Artist1/file.flac"
-
        run main -i "build/tests/albumlist"
 
        assert_success
@@ -145,9 +146,6 @@ teardown() {
 }
 
 @test "failed: create symlink for Alben/Artist1/file.flac" {
-       mkdir --parents "build/tests/output"
-       mkdir --parents "build/tests/music/Alben/Artist1"
-       echo "testfile" > "build/tests/music/Alben/Artist1/file.flac"
        cp() {
                return 1
        }
@@ -159,11 +157,6 @@ teardown() {
 }
 
 @test "success: copy cover.jpg for Alben/Artist1" {
-       mkdir --parents "build/tests/output"
-       mkdir --parents "build/tests/music/Alben/Artist1"
-       echo "testfile" > "build/tests/music/Alben/Artist1/file.flac"
-       echo "cover" > "build/tests/music/Alben/Artist1/cover.jpg"
-
        run main -i "build/tests/albumlist"
 
        assert_success
@@ -173,10 +166,6 @@ teardown() {
 }
 
 @test "failed: copy cover.jpg for Alben/Artist1" {
-       mkdir --parents "build/tests/output"
-       mkdir --parents "build/tests/music/Alben/Artist1"
-       echo "testfile" > "build/tests/music/Alben/Artist1/file.flac"
-       echo "cover" > "build/tests/music/Alben/Artist1/cover.jpg"
        rsync() {
                return 1
        }