32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/**
|
|
* Verification Script for Customer Mapping
|
|
*/
|
|
const VDAParser = require('./js/vda-parser.js').VDAParser;
|
|
const ConfigParser = require('./js/config-parser.js').ConfigParser;
|
|
|
|
// 1. Test getCustomerId
|
|
const vda711 = "71101SENDERID 5060 00001240520";
|
|
const id711 = VDAParser.getCustomerId(vda711);
|
|
console.log(`VDAParser.getCustomerId(711): "${id711}" (expected "5060")`);
|
|
|
|
const vda511 = "51101SENDERID 1234 00001240520";
|
|
const id511 = VDAParser.getCustomerId(vda511);
|
|
console.log(`VDAParser.getCustomerId(511): "${id511}" (expected "1234")`);
|
|
|
|
// 2. Test lookupCustomerMode
|
|
const configText = `
|
|
[CUSTOMER_MAPPING]
|
|
5060=outbound-bosch
|
|
1234=outbound-ifm
|
|
`;
|
|
const config = ConfigParser.parse(configText);
|
|
|
|
const mode1 = ConfigParser.lookupCustomerMode(config, "5060");
|
|
console.log(`ConfigParser.lookupCustomerMode("5060"): "${mode1}" (expected "outbound-bosch")`);
|
|
|
|
const mode2 = ConfigParser.lookupCustomerMode(config, "1234");
|
|
console.log(`ConfigParser.lookupCustomerMode("1234"): "${mode2}" (expected "outbound-ifm")`);
|
|
|
|
const mode3 = ConfigParser.lookupCustomerMode(config, "9999");
|
|
console.log(`ConfigParser.lookupCustomerMode("9999"): "${mode3}" (expected null)`);
|