fixup node-red-nodes grunt test

This commit is contained in:
Dave Conway-Jones 2024-06-30 17:19:46 +01:00
parent dba4451f57
commit 35c4061748
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
4 changed files with 13 additions and 11 deletions

View File

@ -17,7 +17,7 @@ module.exports = function(grunt) {
},
jshint: {
options: {
jshintrc:true // Use external jshinrc file configured as below
jshintrc:true // Use external jshintrc file configured as below
// http://www.jshint.com/docs/options/
//"asi": true, // allow missing semicolons
//"curly": true, // require braces

View File

@ -35,7 +35,7 @@
"feedparser": "^2.2.10",
"grunt": "^1.6.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-jscs": "^3.0.1",
"grunt-lint-inline": "^1.0.0",
"grunt-simple-mocha": "^0.4.1",
@ -46,7 +46,7 @@
"msgpack-lite": "^0.1.26",
"multilang-sentiment": "^1.2.0",
"ngeohash": "^0.6.3",
"node-red": "^3.1.0",
"node-red": "^4.0.1",
"node-red-node-test-helper": "^0.3.2",
"nodemailer": "^6.9.7",
"node-pop3": "^0.9.0",

View File

@ -53,8 +53,8 @@ describe('exif node', function() {
helperNode1.on("input", function(msg) {
// exif.ExifImage.restore();
msg.location.lat.should.equal(51.04365); // this data is stored in the jpg file
msg.location.lon.should.equal(-1.31525);
msg.location.lat.should.equal(51.04364722222222); // this data is stored in the jpg file
msg.location.lon.should.equal(-1.3152472222222222);
done();
});
@ -117,9 +117,9 @@ describe('exif node', function() {
var logEvents = helper.log().args.filter(function(evt) {
return evt[0].type == "exif";
});
logEvents.should.have.length(1);
logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.toString().should.startWith("Error: The given image is not a JPEG");
logEvents.should.have.length(2);
logEvents[1][0].should.have.a.property('msg');
logEvents[1][0].msg.toString().should.startWith("Error: Invalid image format");
done();
},150);

View File

@ -90,11 +90,13 @@ module.exports = function(RED) {
if (Buffer.isBuffer(value)) { // or a proper jpg buffer
msg.exif = ExifReader.load(msg.payload);
for (const p in msg.exif) {
if (msg.exif.hasOwnProperty(p)) {
msg.exif[p] = msg.exif[p].description
if (!isNaN(Number(msg.exif[p]))) {
msg.exif[p] = Number(msg.exif[p])
}
}
}
if (msg.exif && msg.exif.hasOwnProperty("GPSLatitude") && msg.exif.hasOwnProperty("GPSLongitude")) {
addMsgLocationDataFromExifGPSData(msg,value);
}