mirror of
https://github.com/gogrlx/snack.git
synced 2026-04-02 05:08:42 -07:00
fix: improve feature completeness and correctness
Pass 1 (Feature & Completeness): - Replace apt CLI with apt-get for listUpgrades (apt CLI is unstable for scripting) - Verify snapd daemon is running in snap Available() check - Add ErrDaemonNotRunning sentinel error for daemon-dependent managers - Fix staticcheck S1011: replace loop with append(keys, matches...) - Fix staticcheck SA1012: use context.TODO() instead of nil in dpkg tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dpkg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogrlx/snack"
|
||||
@@ -73,14 +74,14 @@ func TestNew(t *testing.T) {
|
||||
|
||||
func TestUpgradeUnsupported(t *testing.T) {
|
||||
d := New()
|
||||
if err := d.Upgrade(nil); err != snack.ErrUnsupportedPlatform {
|
||||
if err := d.Upgrade(context.TODO()); err != snack.ErrUnsupportedPlatform {
|
||||
t.Errorf("expected ErrUnsupportedPlatform, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateUnsupported(t *testing.T) {
|
||||
d := New()
|
||||
if err := d.Update(nil); err != snack.ErrUnsupportedPlatform {
|
||||
if err := d.Update(context.TODO()); err != snack.ErrUnsupportedPlatform {
|
||||
t.Errorf("expected ErrUnsupportedPlatform, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user