Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,18 @@ jobs:
- name: Coverage threshold check
working-directory: packages/core/${{ matrix.package }}
run: |
COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')
echo "Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "❌ Coverage is below 90%"
SUMMARY="coverage/coverage-summary.json"
if [ ! -f "$SUMMARY" ]; then
echo "❌ $SUMMARY missing — ensure Jest uses coverageReporters including json-summary"
exit 1
fi
COVERAGE=$(jq -r '.total.lines.pct' "$SUMMARY")
echo "Coverage: $COVERAGE%"
node -e "
const c = parseFloat(process.argv[1]);
if (Number.isNaN(c)) { console.error('Invalid coverage value'); process.exit(1); }
if (c < 90) { console.error('Coverage is below 90%'); process.exit(1); }
" "$COVERAGE"
echo "✅ Coverage is above 90%"

# Job 4: Security audit
Expand Down
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const tsJestTransformCfg = createDefaultPreset().transform;
/** @type {import("jest").Config} **/
module.exports = {
testEnvironment: "node",
testPathIgnorePatterns: [
"/node_modules/",
"\\.e2e\\.test\\.[jt]sx?$",
"MockLedgerTransport\\.ts$",
// Jest matches **/__tests__/**/*.ts — exclude helpers and mocks
"[/\\\\]__tests__[/\\\\]__mocks__[/\\\\]",
"[/\\\\]__tests__[/\\\\]setup\\.ts$",
],
transform: {
...tsJestTransformCfg,
},
Expand Down
19 changes: 16 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"overrides": {
"diff": "^8.0.1",
"handlebars": "4.7.9",
"tar": "^7.5.7",
"xml2js": "^0.6.0",
"blessed-contrib": "^4.11.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/core/defi-protocols/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module.exports = {
},
},
coverageDirectory: 'coverage',
// CI reads coverage-summary.json (see .github/workflows/ci.yml)
coverageReporters: ['text', 'lcov', 'json', 'json-summary'],
verbose: true,
transform: {
'^.+\\.ts$': ['ts-jest', {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/defi-protocols/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/core/oracles/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/core/stellar-sdk/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,8 @@ describe('LedgerWallet', () => {
});

describe('Event Emitter', () => {
it('should emit error events', (done) => {
ledgerWallet.on('error', (error) => {
expect(error).toBeInstanceOf(LedgerError);
done();
});

// Trigger error by trying to get public key without connection
ledgerWallet.getPublicKey().catch(() => {
// Expected to fail
});
it('should reject getPublicKey with LedgerError when not connected', async () => {
await expect(ledgerWallet.getPublicKey()).rejects.toThrow(LedgerError);
});

it('should emit disconnected event', (done) => {
Expand Down
6 changes: 6 additions & 0 deletions packages/core/wallet/auth/src/hardware/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,16 @@ export function buildStellarPath(accountIndex: number = 0): string {
return `44'/148'/${accountIndex}'`;
}

/** Canonical hardened BIP44 path for Stellar (slashes + `'` markers). */
const STELLAR_BIP44_PATH_REGEX = /^44'\/148'\/[0-9]+'$/;

/**
* Validate BIP44 derivation path for Stellar
*/
export function validateStellarPath(path: string): boolean {
if (!STELLAR_BIP44_PATH_REGEX.test(path)) {
return false;
}
try {
const parsed = parseBIP44Path(path);
return parsed.purpose === 44 && parsed.coinType === STELLAR_COIN_TYPE;
Expand Down
Loading
Loading