]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add week old and ok
authorBastian Dehn <hhaalo@arcor.de>
Mon, 10 Aug 2026 18:24:13 +0000 (20:24 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 10 Aug 2026 18:24:13 +0000 (20:24 +0200)
tests/backup_tests.bats

index 97dcf43026f1edbe86ee4276edecd54c3065921e..4eca8108305737350ae225f54510887b3ad24075 100755 (executable)
@@ -1023,4 +1023,44 @@ teardown() {
        assert_line --index 0 "day   2000-01-01 old"
        assert_line --index 1 "week  none       old"
        assert_line --index 2 "month none       old"
+}
+
+# bats test_tags=backup:check
+@test "success check backup date week ok" {
+       mkdir --parents "build/test"
+       printf "none\n2000-01-01\nnone\n" > "build/test/stats"
+       get_unix_date() {
+               date --date="2000-01-01" +%s
+       }
+       get_unix_time() {
+               date --date="2000-01-04" +%s
+       }
+
+       run main "check"
+
+       assert_success
+       [ -f "build/test/stats" ]
+       assert_line --index 0 "day   none       old"
+       assert_line --index 1 "week  2000-01-01 ok"
+       assert_line --index 2 "month none       old"
+}
+
+# bats test_tags=backup:check
+@test "success check backup date week old" {
+       mkdir --parents "build/test"
+       printf "none\n2000-01-01\nnone\n" > "build/test/stats"
+       get_unix_date() {
+               date --date="2000-01-01" +%s
+       }
+       get_unix_time() {
+               date --date="2000-01-08" +%s
+       }
+
+       run main "check"
+
+       assert_success
+       [ -f "build/test/stats" ]
+       assert_line --index 0 "day   none       old"
+       assert_line --index 1 "week  2000-01-01 old"
+       assert_line --index 2 "month none       old"
 }
\ No newline at end of file