Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gpii.test.buildSingleTestFixture = function (testDef, rootGrades) {
testDef.gradeNames = fluid.makeArray(testDef.gradeNames).concat(fluid.makeArray(rootGrades));
// TODO: Discuss whether this is useful/advisable.
testDef.expect = testDef.initialState ? 6 : 5;
testDef.sequenceGrade = testDef.initialState ? "gpii.test.initialStateSequenceGrade" : "gpii.test.snapshotSequenceGrade";
return testDef;
};
fluid.each(secondary.contexts, function (context, contextId) {
var mcontext = master.contexts[contextId];
// if not in master, just copy over from secondary:
if (!mcontext) {
master.contexts[contextId] = context;
} else {
// preferences and metadata should be the only things varying
fluid.extend(true, mcontext.preferences, context.preferences);
mcontext.metadata = fluid.makeArray(mcontext.metadata).concat(fluid.makeArray(context.metadata));
}
});
that[method] = function () {
var promise = deferred.promise, promiseImpl = {},
args = fluid.makeArray(arguments);
// We can not directly modify when's then method. It is set to
// be non-writable (Throws TypeError if we try to assignment operator).
promiseImpl.then = function (callback) {
callback = that.callbackWrapper.wrap(callback);
promise.then.apply(null, [callback]);
};
args.push(that.callbackWrapper.wrap(function () {
deferred.resolve.apply(null, fluid.makeArray(arguments));
}));
that.rawSource[method].apply(null, args);
return promiseImpl;
};
});
gpii.test.elementsBetween = function (origArray, start, end) {
var array = fluid.makeArray(origArray);
start = start || 0;
if (!end && end !== 0) {
end = array.length;
}
array.length = end;
array.splice(0, start);
return array;
};
gpii.acceptanceTesting.buildFlowManagerTestFixture = function (testDef) {
testDef.expect = 1;
testDef.sequence = fluid.makeArray(testDef.sequence);
testDef.members = {
settingsStore: {}
};
testDef.components = $.extend(true, testDef.components, {
fmrequest: {
type: "kettle.tests.request.http",
options: {
requestOptions: {
path: "/%token/settings/%appinfo",
port: 8081,
passthrough: testDef.expected
},
termMap: {
token: "{tests}.options.token",
gpii.test.cloudBased.oauth2.buildTestFixtureCommon = function (testDef, commonRec, baseDir) {
testDef = fluid.extend(true, {}, testDef, commonRec);
testDef.sequence = fluid.makeArray(testDef.sequence);
testDef.gradeNames = fluid.makeArray(testDef.gradeNames);
testDef.gradeNames.push("gpii.test.cloudBased.oauth2.testCaseHolder");
testDef.config = gpii.test.cloudBased.oauth2.gpiiConfig(baseDir);
return testDef;
};
gpii.test.cloudBased.oauth2.bootstrapDisruptedTest = function (testDefs, commonRec,
disruptions, baseDir) {
testDefs = fluid.makeArray(testDefs);
return fluid.transform(disruptions, function (disruption) {
return kettle.test.bootstrapServer(testDefs, function (testDef) {
return gpii.test.cloudBased.oauth2.buildDisruptedFixture(testDef, commonRec, disruption, baseDir);
});
});
};
jqUnit.log = function () {
var args = fluid.makeArray(arguments);
args.unshift("jq: ");
console.log.apply(null, args);
};
gpii.arrayDifference = function (array, valuesToRemove) {
if (!array || !valuesToRemove) {
return;
}
var arrayToRemove = fluid.makeArray(valuesToRemove);
fluid.remove_if(array, function (i) {
return arrayToRemove.includes(i);
});
};
fluid.each(gpii.userListeners.pcsc.knownCards, function (card) {
card.atrs = [];
fluid.each(fluid.makeArray(card.atr), function (atr) {
card.atrs.push(Buffer.from(atr.replace(/\s+/g, ""), "hex"));
});
});