mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-09 12:54:01 +00:00
test(nominatim): check cache file modes only where POSIX modes exist
The disk-cache test asserts the cache directory is 0o700 and its files 0o600. Windows has no POSIX mode bits (the directory stats as 0o666), so the test always failed there. Both checks now run only off Windows, as localServices.test.mjs and mcpPanelKey.test.mjs already do for their 0o600 checks. The cache code is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ac28a11e41
commit
4f43ded5da
1 file changed
+17
-13
@@ -684,25 +684,29 @@ test('the disk cache survives a restart and stays within its bounds', async () =
|
||||
await createNominatimCache({ dir, now: time.now }).get('k0'),
|
||||
null,
|
||||
);
|
||||
assert.equal(
|
||||
fs.statSync(dir).mode & 0o777,
|
||||
0o700,
|
||||
'the query cache directory is private',
|
||||
);
|
||||
// Windows has no POSIX mode bits (directories stat as 0o666), so only
|
||||
// POSIX systems can check privacy this way.
|
||||
if (process.platform !== 'win32')
|
||||
assert.equal(
|
||||
fs.statSync(dir).mode & 0o777,
|
||||
0o700,
|
||||
'the query cache directory is private',
|
||||
);
|
||||
const text = fs
|
||||
.readdirSync(dir)
|
||||
.filter((name) => name.endsWith('.json'))
|
||||
.map((name) => fs.readFileSync(path.join(dir, name), 'utf8'))
|
||||
.join('\n');
|
||||
assert.equal(text.includes('k4'), false, 'disk entries never store raw keys');
|
||||
for (const name of fs
|
||||
.readdirSync(dir)
|
||||
.filter((entry) => entry.endsWith('.json')))
|
||||
assert.equal(
|
||||
fs.statSync(path.join(dir, name)).mode & 0o777,
|
||||
0o600,
|
||||
`${name} is private`,
|
||||
);
|
||||
if (process.platform !== 'win32')
|
||||
for (const name of fs
|
||||
.readdirSync(dir)
|
||||
.filter((entry) => entry.endsWith('.json')))
|
||||
assert.equal(
|
||||
fs.statSync(path.join(dir, name)).mode & 0o777,
|
||||
0o600,
|
||||
`${name} is private`,
|
||||
);
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user