Add test transformations to staff LDB results

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-08-07 10:36:06 +01:00
parent 1c8dfea43d
commit 05764d1897

View File

@ -6,7 +6,7 @@ const util = require('../utils/ldb.utils');
const san = require('../utils/sanitizer.utils'); const san = require('../utils/sanitizer.utils');
const db = require('../services/dbAccess.services'); const db = require('../services/dbAccess.services');
//import { transform as staffStationTransform } from '../utils/translators/ldb/staffStation'; import { transform as staffStationTransform } from '../utils/translators/ldb/staffStation';
const ldbKey = process.env.OWL_LDB_KEY; const ldbKey = process.env.OWL_LDB_KEY;
const ldbsvKey = process.env.OWL_LDB_SVKEY; const ldbsvKey = process.env.OWL_LDB_SVKEY;
@ -65,7 +65,14 @@ async function arrDepBoardStaff(CRS) {
services: 'PBS' services: 'PBS'
}; };
const api = new ldb(ldbsvKey,true); const api = new ldb(ldbsvKey,true);
return await api.call('GetArrivalDepartureBoardByCRS',options,false,false); const result = await api.call('GetArrivalDepartureBoardByCRS',options,false,false);
try {
const transformationTest = staffStationTransform(result)
console.log("Transformation Test Successful")
} catch (err) {
console.log("Transformation Test Failed: " + err)
}
return result
} catch (err) { } catch (err) {
log.out(`ldbService.arrDepBoardStaff: Lookup Failed for: ${CRS}`, 'warn'); log.out(`ldbService.arrDepBoardStaff: Lookup Failed for: ${CRS}`, 'warn');
log.out(`ldbService.arrDepBoardStaff: ${err}`); log.out(`ldbService.arrDepBoardStaff: ${err}`);