sheetjs_sheetjs/tests/Common.js

25 lines
769 B
JavaScript
Raw Permalink Normal View History

2013-05-18 00:12:10 +00:00
var XLSX = require('../');
var tests = {
'should be able to open workbook': function (file) {
var xlsx = XLSX.readFile('tests/files/' + file);
expect(xlsx).toBeTruthy();
expect(xlsx).toEqual(jasmine.any(Object));
},
'should define all api properties correctly': function (file) {
var xlsx = XLSX.readFile('tests/files/' + file);
expect(xlsx.Workbook).toEqual(jasmine.any(Object));
expect(xlsx.Props).toBeDefined();
expect(xlsx.Deps).toBeDefined();
expect(xlsx.Sheets).toEqual(jasmine.any(Object));
expect(xlsx.SheetNames).toEqual(jasmine.any(Array));
expect(xlsx.Strings).toBeDefined();
expect(xlsx.Styles).toBeDefined();
}
};
module.exports = function (file) {
for (var key in tests) {
it(key, tests[key].bind(undefined, file));
}
};