feat: (broken) implement route map and address autocomplete widgets with associated infrastructure testing scripts
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const axios = require('axios');
|
||||
require('dotenv').config({ path: '.env' });
|
||||
const { googleMapsComputeRoute } = require('./src/travel.js');
|
||||
|
||||
async function testToulouse() {
|
||||
const origin = "25 Impasse du Puits du Suc, Saint-Martin-en-Haut, France";
|
||||
const destination = "Toulouse, France";
|
||||
|
||||
const req = {
|
||||
headers: { authorization: 'Bearer MOCK' },
|
||||
body: { origin, destination, vehicleTollCategory: 2 }
|
||||
};
|
||||
let resultBody = null;
|
||||
const res = {
|
||||
set: () => {}, status: () => res,
|
||||
json: (data) => { resultBody = data; return res; },
|
||||
send: (data) => { resultBody = data; return res; }
|
||||
};
|
||||
|
||||
const auth = require('./utils/auth');
|
||||
auth.authenticateUser = async () => {};
|
||||
|
||||
await googleMapsComputeRoute(req, res);
|
||||
|
||||
if (resultBody.error) {
|
||||
console.error(`Error: ${resultBody.error}`);
|
||||
} else {
|
||||
console.log(JSON.stringify(resultBody.routes[0], null, 2));
|
||||
}
|
||||
}
|
||||
testToulouse();
|
||||
Reference in New Issue
Block a user