Skip to content

Commit

Permalink
avoid assertions for legacy macos /home mountpoint. Skip /run/credent…
Browse files Browse the repository at this point in the history
…ials/**.
  • Loading branch information
mceachen committed Nov 22, 2024
1 parent d84681c commit 580b410
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const ExcludedMountPointGlobsDefault = [
"/run/snapd/**",
"/run/user/*/doc",
"/run/user/*/gvfs",
"/run/credentials/**",
"/snap/**",
"/sys/**",
] as const;
Expand Down
17 changes: 11 additions & 6 deletions src/test-utils/assert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// src/test-utils/assert.ts
import { isMacOS } from "../platform.js";
import type { VolumeMetadata } from "../volume_metadata.js";

/**
Expand All @@ -21,12 +22,16 @@ export function assertMetadata(metadata: VolumeMetadata | undefined) {
}

// Size checks
expect(metadata.size).toBeGreaterThan(0);
expect(metadata.used).toBeGreaterThanOrEqual(0);
expect(metadata.available).toBeGreaterThanOrEqual(0);
expect(metadata.used + metadata.available).toBeLessThanOrEqual(
metadata.size,
);
if (isMacOS && metadata.mountPoint === "/System/Volumes/Data/home") {
// skip size checks for this path on macOS, it's for the legacy /home mount which may be empty
} else {
expect(metadata.size).toBeGreaterThan(0);
expect(metadata.used).toBeGreaterThanOrEqual(0);
expect(metadata.available).toBeGreaterThanOrEqual(0);
expect(metadata.used + metadata.available).toBeLessThanOrEqual(
metadata.size,
);
}

// Optional fields with type checking
if (metadata.label !== undefined) {
Expand Down

0 comments on commit 580b410

Please sign in to comment.