Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ jobs:
run: npm ci

- name: Install jq
uses: sergeysova/jq-action@v2
run: sudo apt-get update && sudo apt-get install -y jq

- name: Install yq
uses: mikefarah/yq@v4.40.1

- name: Setup Bats and bats libs
id: setup-bats
uses: bats-core/bats-action@3.0.1
with:
cache: false

- name: Run tests
shell: bash
Expand Down Expand Up @@ -90,7 +88,7 @@ jobs:

# Commit the changes
git add .
git commit -m "chore(release): ${VERSION}
git commit --no-verify -m "chore(release): ${VERSION}

This automated release updates version numbers across all plugins.
"
Expand Down
17 changes: 13 additions & 4 deletions plugins/auto-updater/tests/timestamp-update.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# Tests for timestamp update conditional logic
#

# Store original check.sh to restore after tests
# Store original files to restore after tests
ORIGINAL_CHECK=""
ORIGINAL_UPDATE=""

setup() {
export TEST_DIR="${BATS_TEST_DIRNAME}"
Expand All @@ -18,25 +19,33 @@ setup() {
export CONFIG_DIR="$HOME/.claude/auto-updater"
mkdir -p "$CONFIG_DIR"

# Backup original check.sh
# Backup original check.sh and update.sh
ORIGINAL_CHECK="${SCRIPT_DIR}/check.sh"
ORIGINAL_UPDATE="${SCRIPT_DIR}/update.sh"
if [ -f "$ORIGINAL_CHECK" ]; then
cp "$ORIGINAL_CHECK" "${TEMP_DIR}/check.sh.backup"
fi
if [ -f "$ORIGINAL_UPDATE" ]; then
cp "$ORIGINAL_UPDATE" "${TEMP_DIR}/update.sh.backup"
fi
}

teardown() {
# Restore original check.sh
# Restore original check.sh and update.sh
if [ -f "${TEMP_DIR}/check.sh.backup" ]; then
cp "${TEMP_DIR}/check.sh.backup" "$ORIGINAL_CHECK"
fi
if [ -f "${TEMP_DIR}/update.sh.backup" ]; then
cp "${TEMP_DIR}/update.sh.backup" "$ORIGINAL_UPDATE"
fi
rm -rf "$TEMP_DIR"
}

# Helper: Set last-check timestamp to N seconds ago
set_last_check_time() {
local seconds_ago="$1"
local current_time=$(date +%s)
local current_time
current_time=$(date +%s)
local timestamp=$((current_time - seconds_ago))
echo "$timestamp" > "$CONFIG_DIR/last-check"
}
Expand Down
Loading