Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests re #2763 #2762 #2764

Closed
wants to merge 7 commits into from
16 changes: 14 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,14 @@ describe('input formats', function() {
var workBookFromRawBase64 = X.read(fileInBase64, { type: 'base64' });
var workBookFromBase64WithinDataURI = X.read(fileInBase64WithDataURIScheme, { type: 'base64' });

var jsonSheet1 = X.utils.sheet_to_json(workBookFromRawBase64.Sheets.Sheet1);
var jsonSheet2 = X.utils.sheet_to_json(workBookFromBase64WithinDataURI.Sheets.Sheet1);

// Assert
assert.deepStrictEqual(workBookFromRawBase64, workBookFromBase64WithinDataURI);
assert.equal(
JSON.stringify(jsonSheet1),
JSON.stringify(jsonSheet2)
);
});
it('handles base64 where data URI has no media type (gh-2762)', function() {
// Arrange
Expand All @@ -710,8 +716,14 @@ describe('input formats', function() {
var workBookFromRawBase64 = X.read(fileInBase64, { type: 'base64' });
var workBookFromBase64WithinDataURI = X.read(fileInBase64WithDataURIScheme, { type: 'base64' });

var jsonSheet1 = X.utils.sheet_to_json(workBookFromRawBase64.Sheets.Sheet1);
var jsonSheet2 = X.utils.sheet_to_json(workBookFromBase64WithinDataURI.Sheets.Sheet1);

// Assert
assert.deepStrictEqual(workBookFromRawBase64, workBookFromBase64WithinDataURI);
assert.equal(
JSON.stringify(jsonSheet1),
JSON.stringify(jsonSheet2)
);
});
if(typeof Uint8Array !== 'undefined') it('should read array', function() { artifax.forEach(function(p) {
X.read(fs.readFileSync(p, 'binary').split("").map(function(x) { return x.charCodeAt(0); }), {type:'array'});
Expand Down