mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix: simplify Google Maps provider setup
This commit is contained in:
1 parent
aacfa06a31
commit
c6462be066
5 files changed
+30
-13
No files matched your search
@@ -63,7 +63,7 @@ test('the status payload reports presence without any credential material', () =
|
||||
// Secret missing: the OpenSky pair must read as NOT set.
|
||||
};
|
||||
const status = keySetupStatus(env);
|
||||
assert.equal(status.total, KEY_SETUP_KEYS.length);
|
||||
assert.equal(status.total, KEY_SETUP_KEYS.filter((key) => !key.hidden).length);
|
||||
const google = status.keys.find((key) => key.id === 'google-maps');
|
||||
assert.equal(google.set, true);
|
||||
const opensky = status.keys.find((key) => key.id === 'opensky');
|
||||
@@ -342,15 +342,23 @@ test('validation rejects dotenv metacharacters that would round-trip wrong', ()
|
||||
}
|
||||
});
|
||||
|
||||
test('server Google key can be saved and removed without appearing in status values', () => {
|
||||
test('server Google key remains supported without appearing in setup or its missing count', () => {
|
||||
const secret = 'server-key-fixture';
|
||||
assert.deepEqual(validateKeySetupUpdates({ GOOGLE_MAPS_SERVER_API_KEY: secret }), {
|
||||
ok: true, updates: { GOOGLE_MAPS_SERVER_API_KEY: secret },
|
||||
});
|
||||
assert.equal(validateKeySetupUpdates({ GOOGLE_MAPS_SERVER_API_KEY: null }).ok, true);
|
||||
const status = keySetupStatus({ GOOGLE_MAPS_SERVER_API_KEY: secret });
|
||||
const entry = status.keys.find((key) => key.id === 'google-maps-server');
|
||||
assert.equal(entry.set, true);
|
||||
assert.ok(!entry.clientExposed);
|
||||
assert.deepEqual(status, keySetupStatus({}));
|
||||
assert.equal(status.keys.some((key) => key.id === 'google-maps-server'), false);
|
||||
assert.equal(keySetupRequirement('google-maps-server'), '');
|
||||
assert.equal(status.keys.find((key) => key.id === 'google-maps').title, 'GOOGLE MAPS');
|
||||
const allVisibleConfigured = Object.fromEntries(status.keys.flatMap((key) =>
|
||||
key.envVars.map((name) => [name, 'configured-fixture']),
|
||||
));
|
||||
const complete = keySetupStatus(allVisibleConfigured);
|
||||
assert.equal(complete.setCount, complete.total, 'an absent server key must not leave setup incomplete');
|
||||
assert.deepEqual(complete, keySetupStatus({ ...allVisibleConfigured, GOOGLE_MAPS_SERVER_API_KEY: secret }));
|
||||
assert.ok(!JSON.stringify(status).includes('GOOGLE_MAPS_SERVER_API_KEY'));
|
||||
assert.ok(!JSON.stringify(status).includes(secret));
|
||||
});
|
||||
Reference in new issue
Block a user