ci: expand shared package validation and test coverage
- Add lint, formatting, vet, and publish workflow checks - Run Go database tests with PostgreSQL and add Java tests - Make consumer sync opt-in; update docs and Go dependency
This commit is contained in:
1 parent
937f51b4fb
commit
0ff94f9b10
107 files changed
+10124
-410
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { Info, Store } from '../src/coreconfig.js';
|
||||
import { Info, Store, internalSecretMatches } 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' });
|
||||
@@ -48,3 +48,20 @@ test('Info.fromJSON/toJSON round-trip the wire shape', () => {
|
||||
assert.deepEqual(info.carrierNodeUrls, ['http://carrier.example.com', 'http://carrier2.example.com']);
|
||||
assert.equal(info.toJSON().carrierNodeUrl, 'http://carrier.example.com');
|
||||
});
|
||||
|
||||
test('internal secret check fails closed when the secret is unset or empty', () => {
|
||||
assert.equal(internalSecretMatches(undefined, undefined), false);
|
||||
assert.equal(internalSecretMatches(undefined, ''), false);
|
||||
assert.equal(internalSecretMatches('', ''), false);
|
||||
assert.equal(internalSecretMatches(undefined, 'shared-secret'), false);
|
||||
assert.equal(internalSecretMatches('shared-secreT', 'shared-secret'), false);
|
||||
assert.equal(internalSecretMatches('shared-secret', 'shared-secret'), true);
|
||||
});
|
||||
|
||||
test('set rejects a URL that is not an http or https URL and changes nothing', () => {
|
||||
const store = new Store({ authGuardUrl: 'http://auth.example.com' });
|
||||
assert.throws(() => store.set({ authGuardUrl: 'javascript:alert(1)' }), TypeError);
|
||||
assert.throws(() => store.set({ authGuardUrl: 'auth.example.com' }), TypeError);
|
||||
assert.throws(() => store.set({ carrierNodeUrls: ['ftp://carrier.example.com'] }), TypeError);
|
||||
assert.equal(store.authGuardUrl, 'http://auth.example.com');
|
||||
});
|
||||
Reference in new issue
Block a user