Update the tests
This commit is contained in:
parent
f59752bf4f
commit
665d3166ed
1 changed files with 1 additions and 15 deletions
|
@ -40,26 +40,12 @@ describe('nativeImage module', () => {
|
||||||
|
|
||||||
const imagePath = `${path.join(__dirname, 'fixtures', 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`;
|
const imagePath = `${path.join(__dirname, 'fixtures', 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`;
|
||||||
const image = nativeImage.createFromPath(imagePath);
|
const image = nativeImage.createFromPath(imagePath);
|
||||||
const nsimage = image.asNativeRepresentation('nsimage');
|
const nsimage = image.getNativeHandle();
|
||||||
|
|
||||||
assert.equal(nsimage.length, 8);
|
assert.equal(nsimage.length, 8);
|
||||||
|
|
||||||
// If all bytes are null, that's Bad
|
// If all bytes are null, that's Bad
|
||||||
assert.equal(nsimage.reduce((acc,x) => acc || (x != 0)), true);
|
assert.equal(nsimage.reduce((acc,x) => acc || (x != 0)), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Throws when asNativeRepresentation gets a bogus value', () => {
|
|
||||||
const imagePath = `${path.join(__dirname, 'fixtures', 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`;
|
|
||||||
const image = nativeImage.createFromPath(imagePath);
|
|
||||||
|
|
||||||
let shouldDie = true;
|
|
||||||
try {
|
|
||||||
image.asNativeRepresentation('__foobar__');
|
|
||||||
} catch (e) {
|
|
||||||
shouldDie = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.equal(shouldDie, false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue