Skip to content
Open
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ The CSV parser does not handle Chinese full-width commas (U+FF0C `,`). See Iss
## Error Handling
Added proper timeout handling for all API calls.
// Webhook integration implemented

## Manual Verification

Issue #40 uses manual verification code `2323`. Run `npm test` to verify the
code path together with the parser regression tests.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A simple CSV parser - BountyPay workflow demo",
"main": "src/parser.js",
"scripts": {
"test": "node test/parser.test.js"
"test": "node test/parser.test.js && node test/manual-verification.test.js"
},
"license": "MIT"
}
15 changes: 15 additions & 0 deletions src/manual-verification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const MANUAL_VERIFICATION_CODE = '2323';

function normalizeVerificationCode(value) {
return String(value ?? '').trim();
}

function verifyManualCode(value) {
return normalizeVerificationCode(value) === MANUAL_VERIFICATION_CODE;
}

module.exports = {
MANUAL_VERIFICATION_CODE,
normalizeVerificationCode,
verifyManualCode,
};
34 changes: 34 additions & 0 deletions test/manual-verification.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const {
MANUAL_VERIFICATION_CODE,
normalizeVerificationCode,
verifyManualCode,
} = require('../src/manual-verification');

let passed = 0;
let failed = 0;

function assert(name, actual, expected) {
const a = JSON.stringify(actual);
const e = JSON.stringify(expected);
if (a === e) {
console.log(` OK ${name}`);
passed++;
} else {
console.log(` FAIL ${name}`);
console.log(` Expected: ${e}`);
console.log(` Actual: ${a}`);
failed++;
}
}

console.log('\nManual Verification Tests\n');

assert('documents the issue #40 verification code', MANUAL_VERIFICATION_CODE, '2323');
assert('accepts the expected verification code', verifyManualCode('2323'), true);
assert('trims whitespace around manual input', verifyManualCode(' 2323 '), true);
assert('rejects an incorrect code', verifyManualCode('2324'), false);
assert('rejects missing input', verifyManualCode(undefined), false);
assert('normalizes null to an empty string', normalizeVerificationCode(null), '');

console.log(`\nResults: ${passed} passed, ${failed} failed\n`);
process.exit(failed > 0 ? 1 : 0);