Created
September 5, 2018 11:16
-
-
Save rozek/cabde4d258505dc04bafae28cb7c512c to your computer and use it in GitHub Desktop.
basic JavaScript object with properties useful for unit testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** basic JavaScript object whose properties could be used for unit testing ****/ | |
function newTestObject () { | |
return { | |
undefined:undefined, | |
null:null, | |
true:true, false:false, | |
negativeInteger:-123, zero:0, positiveInteger:123, | |
negativeInfinity:-Infinity, Number:Math.PI, positiveInfinity:Infinity, NaN:NaN, | |
emptyString:'', String:'Test', | |
lambda:function (x) { return x*x }, | |
namedFunction:function Test () { return 'Hello, World!' }, | |
emptyObject:{}, FoundationObject:Object.create(null), Object:{ | |
undefined:undefined, | |
null:null, | |
true:true, false:false, | |
negativeInteger:-123, zero:0, positiveInteger:123, | |
negativeInfinity:-Infinity, Number:Math.PI, positiveInfinity:Infinity, NaN:NaN, | |
emptyString:'', String:'Test', | |
lambda:function (x) { return x*x }, | |
namedFunction:function Test () { return 'Hello, World!' }, | |
emptyObject:{}, FoundationObject:Object.create(null), Object:{ | |
undefined:undefined, | |
null:null, | |
true:true, false:false, | |
negativeInteger:-123, zero:0, positiveInteger:123, | |
negativeInfinity:-Infinity, Number:Math.PI, positiveInfinity:Infinity, NaN:NaN, | |
emptyString:'', String:'Test', | |
lambda:function (x) { return x*x }, | |
namedFunction:function Test () { return 'Hello, World!' }, | |
emptyObject:{}, FoundationObject:Object.create(null), | |
emptyArray:[] | |
}, emptyArray:[], Array:[ | |
undefined, null, | |
true, false, -123, 0, 123, -Infinity, Math.PI, Infinity, NaN, '', 'Test', | |
function (x) { return x*x }, function Test () { return 'Hello, World!' }, | |
{}, Object.create(null), [] | |
] | |
}, | |
emptyArray:[], Array:[ | |
undefined, null, | |
true, false, -123, 0, 123, -Infinity, Math.PI, Infinity, NaN, '', 'Test', | |
function (x) { return x*x }, function Test () { return 'Hello, World!' }, | |
{}, Object.create(null), { | |
undefined:undefined, | |
null:null, | |
true:true, false:false, | |
negativeInteger:-123, zero:0, positiveInteger:123, | |
negativeInfinity:-Infinity, Number:Math.PI, positiveInfinity:Infinity, NaN:NaN, | |
emptyString:'', String:'Test', | |
lambda:function (x) { return x*x }, | |
namedFunction:function Test () { return 'Hello, World!' }, | |
emptyObject:{}, FoundationObject:Object.create(null), | |
emptyArray:[] | |
}, [], [ | |
undefined, null, | |
true, false, -123, 0, 123, -Infinity, Math.PI, Infinity, NaN, '', 'Test', | |
function (x) { return x*x }, function Test () { return 'Hello, World!' }, | |
{}, Object.create(null), [] | |
] | |
] | |
}; | |
}; | |
var TestObject = newTestObject(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment