Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Open the stats window at midnight on its first day
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0112-stats.sh | 28 |
1 file changed, 28 insertions, 0 deletions
diff --git a/tests/t0112-stats.sh b/tests/t0112-stats.sh index 7b08a6b..7e1fcc5 100755 --- a/tests/t0112-stats.sh +++ b/tests/t0112-stats.sh @@ -96,4 +96,32 @@ test_expect_success 'every period renders its own columns' ' grep -E "<th[^>]*>[0-9]{4}</th>" tmp ' +# The yearly window opens on the first of January three years back. cgit reads +# the real clock, so the two commits sit either side of midnight on that day. +test_expect_success 'the window opens at midnight on its first day' ' + first=$(($(date -u +%Y) - 3)) && + test_create_repo repos/edge && + ( + cd repos/edge && + GIT_AUTHOR_NAME="Too Early" \ + GIT_AUTHOR_DATE="$((first - 1))-12-31 23:59:59 +0000" \ + GIT_COMMITTER_DATE="$((first - 1))-12-31 23:59:59 +0000" \ + git commit --allow-empty -m before && + GIT_AUTHOR_NAME="Early Bird" \ + GIT_AUTHOR_DATE="$first-01-01 00:00:00 +0000" \ + GIT_COMMITTER_DATE="$first-01-01 00:00:00 +0000" \ + git commit --allow-empty -m first + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "max-stats=year" && + echo "repo.url=edge" && + echo "repo.path=$PWD/repos/edge/.git" + } >edgerc && + CGIT_CONFIG="$PWD/edgerc" QUERY_STRING="url=edge/stats/&period=y" cgit >tmp && + grep ">Early Bird<" tmp && + ! grep ">Too Early<" tmp +' + test_done |
