mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(places): a rebuild writes its files before removing stale tiles, and keeps the build date when nothing changed
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
30ec362c13
commit
a2c86c0fed
4 files changed
+55
-4
No files matched your search
@@ -8,6 +8,7 @@ import { createHash } from 'node:crypto';
|
||||
import { readdir, readFile } from 'node:fs/promises';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
keepBuiltIfUnchanged,
|
||||
placeTileFiles,
|
||||
tileKey,
|
||||
withoutCities,
|
||||
@@ -103,3 +104,13 @@ test('twins are found where longitude cells narrow, and across 180°', () => {
|
||||
['Q1', 'Q3'],
|
||||
);
|
||||
});
|
||||
|
||||
test('a rebuild of unchanged rows keeps the earlier build stamp', () => {
|
||||
const earlier = `${JSON.stringify({ meta: { built: '2026-01-01T00:00:00.000Z', count: 2 }, rows: [1, 2] })}\n`;
|
||||
const same = `${JSON.stringify({ meta: { built: '2026-11-18T00:00:00.000Z', count: 2 }, rows: [1, 2] })}\n`;
|
||||
const changed = `${JSON.stringify({ meta: { built: '2026-11-18T00:00:00.000Z', count: 3 }, rows: [1, 2, 3] })}\n`;
|
||||
assert.equal(keepBuiltIfUnchanged(same, earlier), earlier);
|
||||
assert.equal(keepBuiltIfUnchanged(changed, earlier), changed);
|
||||
assert.equal(keepBuiltIfUnchanged(same, undefined), same);
|
||||
assert.equal(keepBuiltIfUnchanged(same, 'not json'), same);
|
||||
});
|
||||
Reference in new issue
Block a user