aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_data.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-30 19:56:47 +0200
committerDanilo M. <danix@danix.xyz>2026-09-30 19:56:47 +0200
commite55896ce41d6165105671da5b6f33813106ef1b8 (patch)
tree082c5a7dffda63bbe740363fb35ca6dd1927b5ab /test/test_data.lua
parent9f6414838d4fabc174bb193f34225de8d9fc8079 (diff)
downloadconky-theme-udt-e55896ce41d6165105671da5b6f33813106ef1b8.tar.gz
conky-theme-udt-e55896ce41d6165105671da5b6f33813106ef1b8.zip
feat: add an updates card showing nvtable's package table
Moves the nvchecker/nvtable table the login shell printed onto the dashboard, as a wide card at the bottom centre. bin/updates-sample.sh caches `nvtable -C -E` every ten minutes and starts nvchecker, fully detached, at most every 30 minutes. The widget parses the cache and colours it in the board's language: installed behind upstream is critical, a shipped .info behind is a warning, with nvtable's status dots per row and a legend on the bottom line. The mouse wheel scrolls rows that do not fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test/test_data.lua')
-rw-r--r--test/test_data.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua
index 4ed58f8..ec95fae 100644
--- a/test/test_data.lua
+++ b/test/test_data.lua
@@ -461,3 +461,20 @@ assert(not im.week, 'no scope line: today')
assert(data.immich_parse('generated 1\nscope week\n').week, 'scope week parses')
print('test_data: all assertions passed')
+
+-- nvtable_parse: nvtable -C -E rows. The marker column is positional, so an
+-- empty installed or repo column ('--') must not shift it.
+local up = data.nvtable_parse(read('test/fixtures/updates_cache'))
+assert(up and #up == 6, 'updates rows, got ' .. tostring(up and #up))
+local r = up[1]
+assert(r.repo == 'personal' and r.name == 'foo-bin' and r.installed == '1.14.9'
+ and r.shipped == '1.14.9' and r.behind and r.bump and r.upstream == '1.14.10',
+ 'updates row 1')
+assert(up[2].behind and not up[2].bump and up[2].upstream == '2.1.284', 'updates row 2')
+assert(up[3].upstream == nil and up[3].shipped == '3.16.31', 'updates row 3')
+assert(up[4].shipped == nil and up[4].repo == nil, 'updates row 4: -- is nil')
+assert(up[5].installed == nil and not up[5].behind, 'updates row 5: not installed')
+assert(not up[6].behind and not up[6].bump, 'updates row 6: current')
+assert(up.upgrade == 3 and up.bump == 1 and up.current == 46 and up.missing == 18,
+ 'updates summary')
+assert(data.nvtable_parse('') == nil, 'updates: empty cache is nil')