Skip to content
Snippets Groups Projects
Commit a9596dab authored by Dookarun, Jason J (PG/T - Comp Sci & Elec Eng)'s avatar Dookarun, Jason J (PG/T - Comp Sci & Elec Eng)
Browse files

saving tests locally.

parent 4656195f
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -7,12 +7,17 @@
"author": "Jason J Dookarun",
"license": "ISC",
"dependencies": {
"assert": "^2.0.0",
"axios": "^1.3.5",
"body-parser": "^1.18.3",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"geolib": "^3.3.3",
"jest": "^29.5.0",
"jsonwebtoken": "^9.0.0",
"mongoose": "^5.3.16",
"morgan": "^1.9.1",
"node-geocoder": "^4.2.0",
"nodemon": "^1.18.4"
},
"scripts": {
......
......@@ -7,7 +7,8 @@ const port = 3000;
const ParkingLocation = require('./model/ParkingLocation');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');
const geolib = require('geolib');
const axios = require('axios');
function APIKeyAccess() {
const API_KEY = process.env.REACT_APP_GOOGLE_MAPS_API_KEY;
......@@ -43,6 +44,25 @@ app.get('/parking-locations', async (request, response) => {
}
});
// // function focused on finding nearby parking based on radius
// app.get('/parking-locations/:postcode', async (request, response) => {
// try {
// const postcode = request.params.postcode;
// const url = `https://api.postcodes.io/postcodes/${encodeURIComponent(postcode)}`;
// const { data } = await axios.get(url);
// const { latitude, longitude } = data.result;
// console.log(`🌐: Successfully retrieved latitude ${latitude} and longitude ${longitude} from postcode ${postcode}.`);
// response.send({ latitude, longitude });
// } catch (error) {
// console.error(`Error retrieving latitude and longitude from postcode ${postcode}: ${error.message}`);
// response.status(500).send(`Error retrieving latitude and longitude from postcode ${postcode}: ${error.message}`);
// }
// });
function isAdmin(request, response, next) {
const authHeader = request.headers.authorization;
const token = authHeader && authHeader.split(' ')[1];
......
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response time is less than 200ms", function (){
pm.expect(pm.response.responseTime).to.be.below(200);
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment