Browse Source

Added PNG buffer test and fixed dockerfile

pull/127/head
james.cryer 7 years ago
parent
commit
f9c86db193
  1. 5
      .dockerignore
  2. BIN
      demoassets/ghost1.png
  3. BIN
      demoassets/ghost2.png
  4. 26
      nodejs-tests/resemble.test.js

5
.dockerignore

@ -1,8 +1,7 @@
.idea .idea
node_modules **/node_modules
demoassets
npm-debug.log npm-debug.log
libs **/libs
index.html index.html
bower.json bower.json
README.md README.md

BIN
demoassets/ghost1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
demoassets/ghost2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

26
nodejs-tests/resemble.test.js

@ -70,7 +70,7 @@ describe('resemble', () => {
}); });
}); });
test('node buffers', () => { test('node buffers jpg', () => {
const people = fs.readFileSync('./demoassets/People.jpg'); const people = fs.readFileSync('./demoassets/People.jpg');
const people2 = fs.readFileSync('./demoassets/People2.jpg'); const people2 = fs.readFileSync('./demoassets/People2.jpg');
@ -89,4 +89,28 @@ describe('resemble', () => {
}); });
}); });
}); });
test('node buffers png', () => {
const people = fs.readFileSync('./demoassets/ghost1.png');
const people2 = fs.readFileSync('./demoassets/ghost2.png');
return new Promise(function(resolve, reject) {
resemble(people).compareTo(people2).onComplete(function(data) {
// console.info('Reached oncomplete for base64_string');
expect(data.diffBounds.bottom).toEqual(138);
expect(data.diffBounds.left).toEqual(90);
expect(data.diffBounds.right).toEqual(157);
expect(data.diffBounds.top).toEqual(107);
expect(data.dimensionDifference.height).toEqual(0);
expect(data.dimensionDifference.width).toEqual(0);
expect(data.isSameDimensions).toBe(true);
expect(data.misMatchPercentage).toEqual('0.27');
resolve();
});
});
});
}); });

Loading…
Cancel
Save