scratch-analysis/test/unit/error.js

25 lines
582 B
JavaScript
Raw Normal View History

2018-12-17 18:11:08 -05:00
const fs = require('fs');
const path = require('path');
const test = require('tap').test;
const analysis = require('../../lib/index');
const invalidBinary = fs.readFileSync(
path.resolve(__dirname, '../fixtures/invalid/garbage.jpg')
);
test('invalid object', t => {
analysis('{}', (err, result) => {
t.type(err, 'object');
t.type(result, 'undefined');
t.end();
});
});
test('invalid binary', t => {
analysis(invalidBinary, (err, result) => {
t.type(err, 'string');
t.type(result, 'undefined');
t.end();
});
});