Skip to content

Commit

Permalink
Add tests for new hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kesslerdev authored Nov 8, 2024
1 parent 6cea24a commit 51b3874
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/dot_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ return {
},
post_install = "touch %s/.hooks_post_install_ran",
post_purge = "touch %s/.hooks_post_purge_ran",
post_link = "touch %s/.hooks_post_link_ran",
post_unlink = "touch %s/.hooks_post_unlink_ran",
}
]],
home_dir,
Expand All @@ -430,13 +432,23 @@ return {
print("Checking for hook_install at:", hook_install)
assert.is_true(path_exists(hook_install), "Post-install hook did not run")

-- Check if post_link hook ran
local hook_link = pl_path.join(home_dir, ".hooks_post_link_ran")
print("Checking for hook_link at:", hook_link)
assert.is_true(path_exists(hook_link), "Post-link hook did not run")

-- Run dot.lua with --purge option for 'dummy_app'
assert.is_true(run_dot "--purge dummy_app")

-- Check if post_purge hook ran
local hook_purge = pl_path.join(home_dir, ".hooks_post_purge_ran")
print("Checking for hook_purge at:", hook_purge)
assert.is_true(path_exists(hook_purge), "Post-purge hook did not run")

-- Check if post_unlink hook ran
local hook_unlink = pl_path.join(home_dir, ".hooks_post_unlink_ran")
print("Checking for hook_unlink at:", hook_unlink)
assert.is_true(path_exists(hook_unlink), "Post-unlink hook did not run")
end)

it("should handle multiple configs in a module", function()
Expand Down

0 comments on commit 51b3874

Please sign in to comment.