fix filebrowser tests

pull/106/head
Muhammad Atif Ali 2 years ago
parent 1a42ab0c45
commit 1171dcc56f

@ -31,16 +31,14 @@ describe("filebrowser", async () => {
const output = await executeScriptInContainer(state, "alpine");
expect(output.exitCode).toBe(0);
expect(output.stdout).toEqual([
"\u001b[0;1mInstalling filebrowser ",
"\u001B[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",
"📂 Serving /root at http://localhost:13339 ",
"",
"Running 'filebrowser --noauth --root /root --port 13339' ",
"",
"📝 Logs at /tmp/filebrowser.log",
]);
});
@ -53,16 +51,14 @@ describe("filebrowser", async () => {
const output = await executeScriptInContainer(state, "alpine");
expect(output.exitCode).toBe(0);
expect(output.stdout).toEqual([
"\u001b[0;1mInstalling filebrowser ",
"\u001B[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",
"📂 Serving /root at http://localhost:13339 ",
"",
"Running 'filebrowser --noauth --root /root --port 13339 -d .config/filebrowser.db' ",
"",
"📝 Logs at /tmp/filebrowser.log",
]);
});
@ -77,14 +73,12 @@ describe("filebrowser", async () => {
expect(output.stdout).toEqual([
"\u001B[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",
"📂 Serving /home/coder/project at http://localhost:13339 ",
"",
"Running 'filebrowser --noauth --root /home/coder/project --port 13339' ",
"",
"📝 Logs at /tmp/filebrowser.log",
]);
});

@ -1,27 +1,30 @@
#!/usr/bin/env bash
# Convert templated variables to shell variables
ROOT_DIR=${FOLDER}
PORT=${PORT}
DB_PATH=${DB_PATH}
LOG_PATH=${LOG_PATH}
# Expand ~ to $HOME
ROOT_DIR=$${ROOT_DIR/#\~/$${HOME}}
BOLD='\033[0;1m'
printf "$${BOLD}Installing filebrowser \n\n"
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
printf "🥳 Installation comlete! \n\n"
printf "🥳 Installation complete! \n\n"
printf "👷 Starting filebrowser in background... \n\n"
# Convert templated variables to shell variables
ROOT_DIR=${FOLDER}
ROOT_DIR=$${ROOT_DIR/\~/$HOME}
PORT=${PORT}
DB_PATH=${DB_PATH}
LOG_PATH=${LOG_PATH}
DB_FLAG=""
if [ "$${DB_PATH}" != "filebrowser.db" ]; then
DB_FLAG="-d $${DB_PATH}"
fi
printf "📂 Serving $${ROOT_DIR} at http://localhost:${PORT} \n\n"
printf "📂 Serving %s at http://localhost:%s \n\n" "$${ROOT_DIR}" "$${PORT}"
filebrowser --noauth --root "$${ROOT_DIR}" --port "$${PORT}" "$${DB_FLAG}" > "$${LOG_PATH}" 2>&1 &

Loading…
Cancel
Save