Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
const proxyquire = require("proxyquire");
const Promise = require("jszip").external.Promise;
describe("XlsxPopulate", () => {
let dateConverter, Workbook, XlsxPopulate, FormulaError, externals;
beforeEach(() => {
dateConverter = jasmine.createSpyObj("dateConverter", ["dateToNumber", "numberToDate"]);
dateConverter.dateToNumber.and.returnValue("NUMBER");
dateConverter.numberToDate.and.returnValue("DATE");
Workbook = jasmine.createSpyObj("Workbook", ["fromBlankAsync", "fromDataAsync", "fromFileAsync"]);
Workbook.fromBlankAsync.and.returnValue("WORKBOOK");
Workbook.fromDataAsync.and.returnValue("WORKBOOK");
Workbook.fromFileAsync.and.returnValue("WORKBOOK");
Workbook.MIME_TYPE = "MIME_TYPE";
// proxyquire doesn't like overriding raw objects... a spy obj works.
'use strict';
/* eslint no-console: 0, no-process-env: 0 */
var fs = require('fs');
var path = require('path');
var JSZip = require('jszip');
var apk;
var indexAsset = 'assets/www/index.html';
var platformPath = path.join(process.env.ANTITAMPERING_TEST_DIR, 'platforms/android');
var tamperedApkPath = path.join(process.env.TRAVIS_BUILD_DIR, 'tests/android-tampered.apk');
new JSZip.external.Promise(function (resolve, reject) {
fs.readFile(path.join(platformPath, 'app/build/outputs/apk/debug/app-debug.apk'), function (_err, _data) {
if (!_err) {
resolve(_data);
} else {
fs.readFile(path.join(platformPath, 'build/outputs/apk/android-debug.apk'), function (err, data) {
if (!err) {
resolve(data);
} else {
reject(err);
}
});
}
});
})
.then(function (data) {
return JSZip.loadAsync(data);
"use strict";
const proxyquire = require("proxyquire");
const Promise = require("jszip").external.Promise;
describe("XmlParser", () => {
let XmlParser, xmlParser, externals;
beforeEach(() => {
// proxyquire doesn't like overriding raw objects... a spy obj works.
externals = jasmine.createSpyObj("externals", ["_"]);
externals.Promise = Promise;
XmlParser = proxyquire("../../lib/XmlParser", {
'./externals': externals,
'@noCallThru': true
});
xmlParser = new XmlParser();
});
public showAnimation(chosenAnim) {
// After static data is loaded to paperjs we can run animations.
// 0.000001 & friends prevent divisions by 0.
var promise = new JSZip.external.Promise(function (resolve, reject) {
JSZipUtils.getBinaryContent("../" + chosenAnim["anim"], function (err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
promise.then(JSZip.loadAsync)
.then(function (zip) {
console.log(zip);
return zip.catch.toString();
//return zip.file("anim.json").async("string");
})
modalViews = require('../core/modals/views');
var selectBoundary = 'selectBoundary',
drawArea = 'drawArea',
delineateWatershed = 'delineateWatershed',
aoiUpload = 'aoiUpload',
freeDraw = 'free-draw',
squareKm = 'square-km',
GA_AOI_CATEGORY = 'AoI Creation';
var codeToLayer = {}; // code to layer mapping
// The shapefile library relies on a native Promise implementation,
// a polyfill for which is available in the JSZip library
if (!window.Promise) {
window.Promise = JSZip.external.Promise;
}
function displayAlert(message, alertType) {
if (message === drawUtils.CANCEL_DRAWING) {
return;
}
var alertView = new modalViews.AlertView({
model: new modalModels.AlertModel({
alertMessage: message,
alertType: alertType
})
});
alertView.render();
}
getZipFile() {
return new JSZip.external.Promise((resolve, reject) => {
JSZipUtils.getBinaryContent(this.el.dataset.endpoint, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
getZipFile() {
return new JSZip.external.Promise((resolve, reject) => {
JSZipUtils.getBinaryContent(this.el.dataset.endpoint, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
get Promise() {
return JSZip.external.Promise;
},
getZipFile() {
return new JSZip.external.Promise((resolve, reject) => {
JSZipUtils.getBinaryContent(this.container.dataset.endpoint, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
return new Promise((res, rej) => {
new JSZip.external.Promise(function (resolve: any, reject: any) {
fs.readFile(filePath, function (err: any, data: any) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
}).then(function (data: any) {
return JSZip.loadAsync(data);
}).then((d: any) => {
res(d);
}).catch((e: any) => rej(e));
});
}