Sync shared snapshot from dcfdb3d
Docker / Docker Build & Push (push) Successful in 6m0s

This commit is contained in:
Gabriel20xx committed 2026-09-14 09:36:48 +02:00
1 parent 8d7c2f69ff
commit a018f3da4c
18 files changed
+747 -46

No files matched your search

@@ -0,0 +1,50 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { Info, Store } from '../src/coreconfig.js';
test('store seeds from the fallback Info', () => {
const store = new Store({ authGuardUrl: 'http://auth.example.com', carrierNodeUrl: 'http://carrier.example.com' });
assert.equal(store.authGuardUrl, 'http://auth.example.com');
assert.equal(store.carrierNodeUrl, 'http://carrier.example.com');
assert.deepEqual(store.carrierNodeUrls, ['http://carrier.example.com']);
});
test('store defaults to empty with no fallback', () => {
const store = new Store();
assert.equal(store.authGuardUrl, '');
assert.deepEqual(store.carrierNodeUrls, []);
});
test('set ignores a blank authGuardUrl rather than clobbering the existing one', () => {
const store = new Store({ authGuardUrl: 'http://auth.example.com' });
store.set({ authGuardUrl: '', carrierNodeUrl: 'http://carrier.example.com' });
assert.equal(store.authGuardUrl, 'http://auth.example.com');
assert.equal(store.carrierNodeUrl, 'http://carrier.example.com');
});
test('set only replaces carrierNodeUrls when the push actually carries one', () => {
const store = new Store({ carrierNodeUrl: 'http://carrier.example.com' });
store.set({ authGuardUrl: 'http://auth.example.com' });
assert.equal(store.carrierNodeUrl, 'http://carrier.example.com');
assert.equal(store.authGuardUrl, 'http://auth.example.com');
});
test('onUpdate is called with the resulting Info after set', () => {
const store = new Store();
const seen = [];
store.onUpdate((info) => seen.push(info));
store.set({ authGuardUrl: 'http://auth.example.com' });
assert.equal(seen.length, 1);
assert.equal(seen[0].authGuardUrl, 'http://auth.example.com');
});
test('Info.fromJSON/toJSON round-trip the wire shape', () => {
const payload = {
authGuardUrl: 'http://auth.example.com',
carrierNodeUrl: 'http://carrier.example.com',
carrierNodeUrls: ['http://carrier.example.com', 'http://carrier2.example.com'],
};
const info = Info.fromJSON(payload);
assert.deepEqual(info.carrierNodeUrls, ['http://carrier.example.com', 'http://carrier2.example.com']);
assert.equal(info.toJSON().carrierNodeUrl, 'http://carrier.example.com');
});