File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /bin/bash
2
2
3
+ # Assign the value to the variable "TEST_DIR"
4
+ # shellcheck disable=SC2155
5
+ export TEST_DIR=" $( pwd) /test_docs_dir_with_files"
3
6
4
-
5
- declare -x TEST_DIR=" "
6
- TEST_DIR=" $( pwd) /test_docs_dir_with_files"
7
-
8
- create_test_dir (){
9
- mkdir " $TEST_DIR "
7
+ create_test_dir () {
8
+ mkdir -p " $TEST_DIR "
10
9
}
11
10
12
- create_test_files (){
13
- create_test_dir;
14
- touch " $TEST_DIR /file1.txt"
15
- touch " $TEST_DIR /file2.txt"
11
+ create_test_files () {
12
+ create_test_dir
13
+ touch " $TEST_DIR /file1.txt"
14
+ touch " $TEST_DIR /file2.txt"
16
15
}
17
16
18
- erase_test_files (){
19
- rm -rf " $TEST_DIR "
17
+ erase_test_files () {
18
+ rm -rf " $TEST_DIR "
20
19
}
21
20
22
21
# Source the script to get the CheckDocsExist function
23
22
source ./src/scripts/check_docs_exist.sh
24
23
25
24
@test " It checks if documents exist in source directory and finds files" {
26
- create_test_files;
25
+ create_test_files
27
26
28
27
export FULL_SOURCE_DOCS_PATH=" $TEST_DIR "
29
28
@@ -34,11 +33,11 @@ source ./src/scripts/check_docs_exist.sh
34
33
[[ " $output " == " Checking if documents exist in the source directory." ]]
35
34
[[ " $status " -eq 0 ]]
36
35
37
- erase_test_files;
36
+ erase_test_files
38
37
}
39
38
40
39
@test " It checks if documents exist in source directory and finds no files" {
41
- create_test_dir;
40
+ create_test_dir
42
41
43
42
ls () { : ; } # Mock ls to simulate an empty directory
44
43
@@ -51,7 +50,7 @@ source ./src/scripts/check_docs_exist.sh
51
50
[[ " $output " =~ " No files found" ]]
52
51
[[ " $status " -eq 1 ]]
53
52
54
- erase_test_files;
53
+ erase_test_files
55
54
}
56
55
57
56
@test " It checks if documents exist in a non-existent source directory" {
You can’t perform that action at this time.
0 commit comments