Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var test = require('./' + name)(context);
// Copy over the tests into the suite
Object.keys(test).forEach(function(key) {
testSuite[key] = test[key];
});
});
if(tests === defaults || tests.indexOf('css') > -1) {
testSuite.css = require('./css')(context);
testSuite.css.setUp = function (callback) {
recreate_doc('css');
callback();
};
}
module.exports = testCase(testSuite);
var nodeunit = require('nodeunit');
var objeq = require('..');
// Load the Example Extensions
require('../examples/extensions');
exports.aggregates = nodeunit.testCase({
setUp: function (callback) {
this.data = objeq([
{ "firstName": "Bill", "lastName": "Bradley", "age": 30 },
{ "firstName": "Thom", "lastName": "Bradford", "age": 40 },
{ "firstName": "Stefano", "lastName": "Rago", "age": 29 },
{ "firstName": "Fred", "lastName": "Wilkinson", "age": 50 },
{ "firstName": "Ted", "lastName": "Williams", "age": 20 },
{ "firstName": "Jed", "lastName": "Clampet", "age": 70 },
{ "firstName": "Will", "lastName": "Robinson", "age": 45 },
{ "firstName": "John", "lastName": "Jacob", "age": 54 },
{ "firstName": "Thom", "lastName": "Smith", "age": 15 },
{ "firstName": "Bill", "lastName": "Blake", "age": 90 },
{ "firstName": "Hank", "lastName": "Williams", "age": 70 },
{ "firstName": "John", "lastName": "Cash", "age": 45 },
{ "firstName": "Joe", "lastName": "Strummer", "age": 54 },
{ "firstName": "Ted", "lastName": "Turner", "age": 15 }
var testCase = require('nodeunit').testCase,
jsdom = require('jsdom').jsdom,
static_document = require('fs').readFileSync('test/fixtures/core.html', 'utf8');
// need to be global as helpers access these variables
window = document = jQuery = $ = null;
var helpers = require('./helpers/helper'),
q = helpers.query_ids;
module.exports = testCase({
setUp: function (callback) {
jQuery = $ = helpers.recreate_doc(static_document);
callback();
},
tearDown: function (callback) {
// clean up
callback();
},
"Basic requirements": function(test) {
test.expect(7);
test.ok( Array.prototype.push, "Array.push()" );
test.ok( Function.prototype.apply, "Function.apply()" );
test.ok( document.getElementById, "getElementById" );
test.ok( document.getElementsByTagName, "getElementsByTagName" );
test.ok( RegExp, "RegExp" );
test.ok( jQuery, "jQuery" );
var persist = require("../lib/persist");
var type = persist.type;
var nodeunit = require("nodeunit");
var util = require("util");
var testUtils = require("../test_helpers/test_utils");
exports['Select'] = nodeunit.testCase({
"use database.json to connect": function(test) {
persist.connect(function(err, connection) {
connection.runSql(testUtils.doNothingSql, function(err) {
if(err) { console.log(err); return; }
test.done();
});
});
}
});
var java = require("../testHelpers").java;
var nodeunit = require("nodeunit");
var util = require("util");
exports['Java8'] = nodeunit.testCase({
"call methods of a class that uses lambda expressions": function(test) {
try {
var TestLambda = java.import('TestLambda');
var lambda = new TestLambda();
var sum = lambda.testLambdaAdditionSync(23, 42);
test.equal(sum, 65);
var diff = lambda.testLambdaSubtractionSync(23, 42);
test.equal(diff, -19);
}
catch (err) {
var unsupportedVersion = java.instanceOf(err.cause, 'java.lang.UnsupportedClassVersionError');
test.ok(unsupportedVersion);
if (unsupportedVersion)
console.log('JRE 1.8 not available');
else
console.error('Java8 test failed with unknown error:', err);
tnclob NCLOB,
tblob BLOB);
CREATE SEQUENCE datatype_test_seq START WITH 1 INCREMENT BY 1 NOMAXVALUE;
CREATE TRIGGER datatype_test_pk_trigger BEFORE INSERT ON datatype_test FOR EACH row
BEGIN
SELECT datatype_test_seq.nextval INTO :new.id FROM dual;
END;
/
*/
var nodeunit = require("nodeunit");
var oracle = require("../");
var settings = JSON.parse(require('fs').readFileSync('./tests-settings.json','utf8'));
exports['IntegrationTest'] = nodeunit.testCase({
setUp: function(callback) {
var self = this;
//console.log("connecting: ", settings);
oracle.connect(settings, function(err, connection) {
if(err) { callback(err); return; }
//console.log("connected");
self.connection = connection;
self.connection.execute("DELETE FROM person", [], function(err, results) {
if(err) { callback(err); return; }
self.connection.execute("DELETE FROM datatype_test", [], function(err, results) {
if(err) { callback(err); return; }
//console.log("rows deleted: ", results);
callback();
});
});
});
var eep = require('eep');
var events = require('events');
var testCase = require('nodeunit').testCase;
var floatEquals = function (a,b) {
var a1 = Math.round(parseFloat(a)*100)/100;
var b2 = Math.round(parseFloat(b)*100)/100;
return a1 == b2;
};
exports.read = testCase({
setUp: function(cb) {
this._openStdin = process.openStdin;
this._log = console.log;
this._exit = process.exit;
var ev = this.ev = new events.EventEmitter();
process.openStdin = function() { return er; }
cb();
},
tearDown: function(cb) {
process.openStdin = this._openStdin;
process.exit = this._exit;
console.log = this._log;
cb();
var eep = require("eep");
var events = require('events');
var testCase = require('nodeunit').testCase;
var floatEquals = function (a,b) {
var a1 = Math.round(parseFloat(a)*100)/100;
var b2 = Math.round(parseFloat(b)*100)/100;
return a1 == b2;
};
exports.read = testCase({
setUp: function(cb) {
this._openStdin = process.openStdin;
this._log = console.log;
this._exit = process.exit;
var ev = this.ev = new events.EventEmitter();
process.openStdin = function() { return er; }
cb();
},
tearDown: function(cb) {
process.openStdin = this._openStdin;
process.exit = this._exit;
console.log = this._log;
cb();
self.emit = function() { return (count == 0) ? 0 : (sum / count); };
self.make = function() { return new AvgFunction(); };
};
CountFunction.protorype = new eep.AggregateFunction();
function CountFunction() {
var self = this; var count = 0;
self.init = function() { count = 0; };
self.accumulate = function() { count++; };
self.compensate = function() { count--; };
self.emit = function() { return count };
self.make = function() { return new CountFunction(); };
}
exports.read = testCase({
setUp: function(cb) {
this._openStdin = process.openStdin;
this._log = console.log;
this._exit = process.exit;
var ev = this.ev = new events.EventEmitter();
process.openStdin = function() { return er; }
cb();
},
tearDown: function(cb) {
process.openStdin = this._openStdin;
process.exit = this._exit;
console.log = this._log;
cb();
var simpleEvents = require('nodeunit').testCase;
var file = '../../lib/eventemitter2';
var EventEmitter2;
if(typeof require !== 'undefined') {
EventEmitter2 = require(file).EventEmitter2;
}
else {
EventEmitter2 = window.EventEmitter2;
}
module.exports = simpleEvents({
'1. A listener added with `once` should only listen once and then be removed.': function (test) {
var emitter = new EventEmitter2();
emitter.once('test1', function () {
test.ok(true, 'The event was raised once');
});
emitter.emit('test1');
emitter.emit('test1');
test.expect(1);
test.done();
},