coercion.spec.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. // ██████╗ ████████╗████████╗ ██████╗ ███████╗██████╗ ███████╗ ██████╗
  2. // ██╔══██╗╚══██╔══╝╚══██╔══╝██╔════╝ ██╔════╝██╔══██╗██╔════╝██╔════╝ ██╗██╗
  3. // ██████╔╝ ██║ ██║ ██║ ███████╗██████╔╝█████╗ ██║ ╚═╝╚═╝
  4. // ██╔══██╗ ██║ ██║ ██║ ╚════██║██╔═══╝ ██╔══╝ ██║ ██╗██╗
  5. // ██║ ██║ ██║ ██║ ╚██████╗ ███████║██║ ███████╗╚██████╗ ╚═╝╚═╝
  6. // ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚══════╝ ╚═════╝
  7. //
  8. // ██████╗ ██████╗ ███████╗██████╗ ██████╗██╗ ██████╗ ███╗ ██╗
  9. // ██╔════╝██╔═══██╗██╔════╝██╔══██╗██╔════╝██║██╔═══██╗████╗ ██║
  10. // ██║ ██║ ██║█████╗ ██████╔╝██║ ██║██║ ██║██╔██╗ ██║
  11. // ██║ ██║ ██║██╔══╝ ██╔══██╗██║ ██║██║ ██║██║╚██╗██║
  12. // ╚██████╗╚██████╔╝███████╗██║ ██║╚██████╗██║╚██████╔╝██║ ╚████║
  13. // ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝
  14. //
  15. // Export the array of tests below.
  16. module.exports = [
  17. ////////////////////////////////////////////
  18. // STRINGS
  19. ////////////////////////////////////////////
  20. { example: 'foo', actual: 'bar', result: 'bar' },
  21. { example: 'foo', actual: '', result: '' },
  22. { example: 'foo', actual: 0, result: '0' },
  23. { example: 'foo', actual: 1, result: '1' },
  24. { example: 'foo', actual: -1.1, result: '-1.1' },
  25. { example: 'foo', actual: -0, result: '0' },
  26. { example: 'foo', actual: +0, result: '0' },
  27. { example: 'foo', actual: true, result: 'true' },
  28. { example: 'foo', actual: false, result: 'false' },
  29. { example: 'foo', actual: {}, result: '' },
  30. { example: 'foo', actual: {foo:'bar'}, result: '' },
  31. { example: 'foo', actual: {foo:{bar:{baz:{}}}}, result: '' },
  32. { example: 'foo', actual: {foo:['bar']}, result: '' },
  33. { example: 'foo', actual: {foo:{bar:{baz:[{}]}}}, result: '' },
  34. { example: 'foo', actual: [], result: '' },
  35. { example: 'foo', actual: ['asdf'], result: '' },
  36. { example: 'foo', actual: [''], result: '' },
  37. { example: 'foo', actual: [235], result: '' },
  38. { example: 'foo', actual: [false], result: '' },
  39. { example: 'foo', actual: [{}], result: '' },
  40. { example: 'foo', actual: [{foo:'bar'}], result: '' },
  41. { example: 'foo', actual: undefined, result: '' },
  42. { example: 'foo', actual: NaN, result: '' },
  43. { example: 'foo', actual: Infinity, result: '' },
  44. { example: 'foo', actual: -Infinity, result: '' },
  45. { example: 'foo', actual: null, result: '' },
  46. { example: 'foo', actual: /some regexp/, result: '' },
  47. { example: 'foo', actual: function(){}, result: '' },
  48. { example: 'foo', actual: new Date('November 5, 1605 GMT'), result: '1605-11-05T00:00:00.000Z' },
  49. { example: 'foo', actual: new (require('stream').Readable)(), result: '' }, // TODO: consider buffering into a string..? needs community discussion
  50. { example: 'foo', actual: new Buffer('asdf'), result: '' }, // TODO: consider converting to string
  51. { example: 'foo', actual: new Error('asdf'), result: '' }, // TODO: consider converting to error stack trace
  52. ////////////////////////////////////////////
  53. // NUMBERS
  54. ////////////////////////////////////////////
  55. { example: 123, actual: 'bar', result: 0 },
  56. { example: 123, actual: '', result: 0 },
  57. { example: 123, actual: '0', result: 0 },
  58. { example: 123, actual: '1', result: 1 },
  59. { example: 123, actual: '-1.1', result: -1.1 },
  60. { example: 123, actual: 'NaN', result: 0 },
  61. { example: 123, actual: 'undefined', result: 0 },
  62. { example: 123, actual: 'null', result: 0 },
  63. { example: 123, actual: '-Infinity', result: 0 },
  64. { example: 123, actual: 'Infinity', result: 0 },
  65. { example: 123, actual: 0, result: 0 },
  66. { example: 123, actual: 1, result: 1 },
  67. { example: 123, actual: -1.1, result: -1.1 },
  68. { example: 123, actual: +0, result: 0 },
  69. { example: 123, actual: -0, result: 0 },
  70. { example: 123, actual: true, result: 1 },
  71. { example: 123, actual: false, result: 0 },
  72. { example: 123, actual: {}, result: 0 },
  73. { example: 123, actual: {foo:'bar'}, result: 0 },
  74. { example: 123, actual: {foo:{bar:{baz:{}}}}, result: 0 },
  75. { example: 123, actual: {foo:['bar']}, result: 0 },
  76. { example: 123, actual: {foo:{bar:{baz:[{}]}}}, result: 0 },
  77. { example: 123, actual: [], result: 0 },
  78. { example: 123, actual: ['asdf'], result: 0 },
  79. { example: 123, actual: [''], result: 0 },
  80. { example: 123, actual: [235], result: 0 },
  81. { example: 123, actual: [false], result: 0 },
  82. { example: 123, actual: [{}], result: 0 },
  83. { example: 123, actual: [{foo:'bar'}], result: 0 },
  84. { example: 123, actual: undefined, result: 0 },
  85. { example: 123, actual: NaN, result: 0 },
  86. { example: 123, actual: Infinity, result: 0 },
  87. { example: 123, actual: -Infinity, result: 0 },
  88. { example: 123, actual: null, result: 0 },
  89. { example: 123, actual: /some regexp/, result: 0 },
  90. { example: 123, actual: function(){}, result: 0 },
  91. { example: 123, actual: new Date('November 5, 1605 GMT'), result: -11491632000000 },
  92. { example: 123, actual: new (require('stream').Readable)(), result: 0 }, // TODO: ??? maybe num bytes read so far?
  93. { example: 123, actual: new Buffer('asdf'), result: 0 }, // TODO: ??? maybe size of the buffer in bytes?
  94. { example: 123, actual: new Error('asdf'), result: 0 }, // TODO: ??? maybe `.status`?
  95. ////////////////////////////////////////////
  96. // BOOLEANS
  97. ////////////////////////////////////////////
  98. { example: true, actual: 'bar', result: false },
  99. { example: true, actual: '', result: false },
  100. { example: true, actual: '-1.1', result: false },
  101. { example: true, actual: 'NaN', result: false },
  102. { example: true, actual: 'undefined', result: false },
  103. { example: true, actual: 'null', result: false },
  104. { example: true, actual: '-Infinity', result: false },
  105. { example: true, actual: 'Infinity', result: false },
  106. { example: true, actual: 'true', result: true },
  107. { example: true, actual: 'false', result: false },
  108. { example: true, actual: '0', result: false },
  109. { example: true, actual: '1', result: true },
  110. { example: true, actual: 0, result: false },
  111. { example: true, actual: 1, result: true },
  112. { example: true, actual: -1.1, result: false },
  113. { example: true, actual: +0, result: false },
  114. { example: true, actual: -0, result: false },
  115. { example: true, actual: true, result: true },
  116. { example: true, actual: false, result: false },
  117. { example: true, actual: {}, result: false },
  118. { example: true, actual: {foo:'bar'}, result: false },
  119. { example: true, actual: {foo:{bar:{baz:{}}}}, result: false },
  120. { example: true, actual: {foo:['bar']}, result: false },
  121. { example: true, actual: {foo:{bar:{baz:[{}]}}}, result: false },
  122. { example: true, actual: [], result: false },
  123. { example: true, actual: ['asdf'], result: false },
  124. { example: true, actual: [''], result: false },
  125. { example: true, actual: [235], result: false },
  126. { example: true, actual: [false], result: false },
  127. { example: true, actual: [{}], result: false },
  128. { example: true, actual: [{foo:'bar'}], result: false },
  129. { example: true, actual: undefined, result: false },
  130. { example: true, actual: NaN, result: false },
  131. { example: true, actual: Infinity, result: false },
  132. { example: true, actual: -Infinity, result: false },
  133. { example: true, actual: null, result: false },
  134. { example: true, actual: /some regexp/, result: false },
  135. { example: true, actual: function(){}, result: false },
  136. { example: true, actual: new Date('November 5, 1605 GMT'), result: false },
  137. { example: true, actual: new (require('stream').Readable)(), result: false },
  138. { example: true, actual: new Buffer('asdf'), result: false },
  139. { example: true, actual: new Error('asdf'), result: false },
  140. ////////////////////////////////////////////
  141. // DICTIONARIES (w/ json-serializable contents)
  142. // (note that `{}` in an exemplar indicates that any keys are permitted, but that their values must be json-serializable)
  143. // (there is no way to specifically indicate a dictionary of literally anything, including a mix of functions and other stuff
  144. // so in that scenario, just use `'==='` instead of `{}` and add additional checks in relevant code to ensure you're dealing
  145. // with a dictionary vs the other things `===` might produce; e.g. strings/functions/streams/whatever - literally anything.)
  146. ////////////////////////////////////////////
  147. { example: {}, actual: 'bar', result: {} },
  148. { example: {}, actual: 123, result: {} },
  149. { example: {}, actual: -0, result: {} },
  150. { example: {}, actual: +0, result: {} },
  151. { example: {}, actual: true, result: {} },
  152. { example: {}, actual: {}, result: {} },
  153. { example: {}, actual: {foo:'bar'}, result: {foo:'bar'} },
  154. { example: {}, actual: {foo:{bar:{baz:{}}}}, result: {foo:{bar:{baz:{}}}} },
  155. { example: {}, actual: {foo:['bar']}, result: {foo:['bar']} },
  156. { example: {}, actual: {foo:{bar:{baz:[{}]}}}, result: {foo:{bar:{baz:[{}]}}} },
  157. { example: {}, actual: [], result: {} },
  158. { example: {}, actual: ['asdf'], result: {} },
  159. { example: {}, actual: [''], result: {} },
  160. { example: {}, actual: [235], result: {} },
  161. { example: {}, actual: [false], result: {} },
  162. { example: {}, actual: [{}], result: {} },
  163. { example: {}, actual: [{foo:'bar'}], result: {} },
  164. { example: {}, actual: undefined, result: {} },
  165. { example: {}, actual: NaN, result: {} },
  166. { example: {}, actual: Infinity, result: {} },
  167. { example: {}, actual: -Infinity, result: {} },
  168. { example: {}, actual: null, result: {} },
  169. { example: {}, actual: /some regexp/, result: {} },
  170. { example: {}, actual: function(){}, result: {} },
  171. { example: {}, actual: new Date('November 5, 1605 GMT'), result: {} },
  172. // Skip Readable stream tests for now since the enumerable properties vary between Node.js versions.
  173. // TODO: bring back support for this by explicitly filtering properties of streams in `.exec()`
  174. // { example: {}, actual: new (require('stream').Readable)(), result: { _readableState: { highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: false, ended: false, endEmitted: false, reading: false, calledRead: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, objectMode: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: true, domain: null, _events: {}, _maxListeners: 10 } },
  175. // Skip Buffer tests for now since the enumerable properties vary between Node.js versions.
  176. // TODO: bring back support for this by explicitly filtering properties of buffers in `.exec()`
  177. // { example: {}, actual: new Buffer('asdf'), result: {} },
  178. { example: {}, actual: new Error('asdf'), result: {} }, // TODO: consider enhancing this behavior to guarantee e.g. `.message` (string), `.stack` (string), `.code` (string), and `.status` (number). Needs community discussion
  179. ////////////////////////////////////////////
  180. // ARRAYS (with json-serializable contents)
  181. // (note that `[]` in an exemplar is actually just shorthand for `['*']`)
  182. // (to indicate an array of literally anything, including a mix of functions and other stuff, use `['===']`)
  183. ////////////////////////////////////////////
  184. { example: [], actual: 'bar', result: [] },
  185. { example: [], actual: 123, result: [] },
  186. { example: [], actual: -0, result: [] },
  187. { example: [], actual: +0, result: [] },
  188. { example: [], actual: true, result: [] },
  189. { example: [], actual: {}, result: [] },
  190. { example: [], actual: {foo:'bar'}, result: [] },
  191. { example: [], actual: {foo:{bar:{baz:{}}}}, result: [] },
  192. { example: [], actual: {foo:['bar']}, result: [] },
  193. { example: [], actual: {foo:{bar:{baz:[{}]}}}, result: [] },
  194. { example: [], actual: [], result: [] },
  195. { example: [], actual: ['asdf'], result: ['asdf'] },
  196. { example: [], actual: [''], result: [''] },
  197. { example: [], actual: [235], result: [235] },
  198. { example: [], actual: [false], result: [false] },
  199. { example: [], actual: [{}], result: [{}] },
  200. { example: [], actual: [{foo:'bar'}], result: [{foo: 'bar'}] },
  201. { example: [], actual: undefined, result: [] },
  202. { example: [], actual: NaN, result: [] },
  203. { example: [], actual: Infinity, result: [] },
  204. { example: [], actual: -Infinity, result: [] },
  205. { example: [], actual: null, result: [] },
  206. { example: [], actual: /some regexp/, result: [] },
  207. { example: [], actual: function(){}, result: [] },
  208. { example: [], actual: new Date('November 5, 1605 GMT'), result: [] },
  209. // { example: [], actual: new (require('stream').Readable)(), result: [] }, // TODO: consider enhancing this behavior to concat the stream contents? Needs community discussion.
  210. // Skip Buffer tests for now since the enumerable properties vary between Node.js versions.
  211. // TODO: bring back support for this by explicitly filtering properties of buffers in `.exec()`
  212. // { example: [], actual: new Buffer('asdf'), result: [ 97, 115, 100, 102 ] },
  213. { example: [], actual: new Error('asdf'), result: [] },
  214. //////////////////////////////////////////////////////
  215. // nested contents of `example: []` and `example: {}`
  216. //////////////////////////////////////////////////////
  217. // Follow JSON-serialization rules for nested objects within `example: []` and `example: {}`
  218. // with the following exceptions:
  219. // • convert Error instances to their `.stack` property (a string)
  220. // • convert RegExp instances to a string
  221. // • convert functions to a string
  222. // • after doing the rest of the things, prune undefined/null items
  223. // • after doing the rest of the things, strip keys w/ undefined/null values
  224. { example: {}, actual: { x: undefined }, result: {} },
  225. { example: {}, actual: { x: NaN }, result: { x: 0 } },
  226. { example: {}, actual: { x: Infinity }, result: { x: 0 } },
  227. { example: {}, actual: { x: -Infinity }, result: { x: 0 } },
  228. { example: {}, actual: { x: null }, result: { x:null } },
  229. { example: {}, actual: { x: function foo(a,b){return a+' '+b;} }, result: { x: 'function foo(a,b){return a+\' \'+b;}' } },
  230. // { example: {}, actual: { x: undefined, null, NaN, -Infinity, Infinity, function(){} }, result: [] },
  231. { example: {}, actual: { x: /some regexp/ig }, result: {x:'/some regexp/gi' }},
  232. { example: {}, actual: { x: new Date('November 5, 1605 GMT') }, result: {x: '1605-11-05T00:00:00.000Z'} },
  233. // Skip Readable stream tests for now since the enumerable properties vary between Node.js versions.
  234. // { example: {}, actual: { x: new (require('stream').Readable)() }, result: { x: { _readableState: {},readable: true,_events: {},_maxListeners: 10 } } },
  235. // Skip Buffer stream tests for now since the enumerable properties vary between Node.js versions.
  236. // { example: {}, actual: { x: new Buffer('asdf') } , result: {x: {}} },
  237. (function (){
  238. // Hard-code a fake `.stack` to avoid differences between computers that would cause tests to fail
  239. var e = new Error('asdf');
  240. e.stack = 'fake_error';
  241. return { example: {}, actual: { x: e }, result: {x:'fake_error'} };
  242. })(),
  243. { example: [], actual: [undefined], result: [] },
  244. { example: [], actual: [null], result: [null] },
  245. { example: [], actual: [NaN], result: [0] },
  246. { example: [], actual: [Infinity], result: [0] },
  247. { example: [], actual: [-Infinity], result: [0] },
  248. { example: [], actual: [function foo(a,b){return a+' '+b;}], result: ['function foo(a,b){return a+\' \'+b;}'] },
  249. { example: [], actual: [/some regexp/gi], result: ['/some regexp/gi'] },
  250. { example: [], actual: [new Date('November 5, 1605 GMT')], result: ['1605-11-05T00:00:00.000Z'] },
  251. // { example: [], actual: [new (require('stream').Readable)()], result: [] },
  252. // { example: [], actual: [new Buffer('asdf')], result: [] },
  253. (function (){
  254. var e = new Error('asdf');
  255. e.stack = 'fake_error';
  256. return { example: [], actual: [e], result: ['fake_error'] };
  257. })(),
  258. ////////////////////////////////////////////
  259. // example: '*' (any JSON-serializable value)
  260. ////////////////////////////////////////////
  261. { example: '*', actual: 'bar', result: 'bar', },
  262. { example: '*', actual: '', result: '', },
  263. { example: '*', actual: '-1.1', result: '-1.1', },
  264. { example: '*', actual: 'NaN', result: 'NaN', },
  265. { example: '*', actual: 'undefined', result: 'undefined', },
  266. { example: '*', actual: 'null', result: 'null', },
  267. { example: '*', actual: '-Infinity', result: '-Infinity', },
  268. { example: '*', actual: 'Infinity', result: 'Infinity', },
  269. { example: '*', actual: 'true', result: 'true', },
  270. { example: '*', actual: 'false', result: 'false', },
  271. { example: '*', actual: '0', result: '0', },
  272. { example: '*', actual: '1', result: '1', },
  273. { example: '*', actual: -0, result: 0, },
  274. { example: '*', actual: +0, result: 0, },
  275. { example: '*', actual: 0, result: 0, },
  276. { example: '*', actual: 1, result: 1, },
  277. { example: '*', actual: -1.1, result: -1.1, },
  278. { example: '*', actual: true, result: true, },
  279. { example: '*', actual: false, result: false, },
  280. { example: '*', actual: {}, result: {}, },
  281. { example: '*', actual: {foo:'bar'}, result: {foo:'bar'}, },
  282. { example: '*', actual: {foo:{bar:{baz:{}}}}, result: {foo:{bar:{baz:{}}}}, },
  283. { example: '*', actual: {foo:['bar']}, result: {foo:['bar']}, },
  284. { example: '*', actual: {foo:{bar:{baz:[{}]}}}, result: {foo:{bar:{baz:[{}]}}}, },
  285. { example: '*', actual: [], result: [], },
  286. { example: '*', actual: ['asdf'], result: ['asdf'], },
  287. { example: '*', actual: [''], result: [''], },
  288. { example: '*', actual: [235], result: [235], },
  289. { example: '*', actual: [false], result: [false], },
  290. { example: '*', actual: [{}], result: [{}], },
  291. { example: '*', actual: [{foo:'bar'}], result: [{foo:'bar'}], },
  292. { example: '*', actual: undefined, result: null, },
  293. { example: '*', actual: NaN, result: 0, },
  294. { example: '*', actual: Infinity, result: 0, },
  295. { example: '*', actual: -Infinity, result: 0, },
  296. { example: '*', actual: null, result: null, },
  297. { example: '*', actual: /some regexp/gi, result: '/some regexp/gi' },
  298. { example: '*', actual: new Date('November 5, 1605 GMT'), result: '1605-11-05T00:00:00.000Z' },
  299. ////////////////////////////////////////////
  300. // example: '->' (any function)
  301. ////////////////////////////////////////////
  302. { example: '->', actual: 'bar', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  303. { example: '->', actual: '', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  304. { example: '->', actual: '-1.1', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  305. { example: '->', actual: 'NaN', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  306. { example: '->', actual: 'undefined', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  307. { example: '->', actual: 'null', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  308. { example: '->', actual: '-Infinity', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  309. { example: '->', actual: 'Infinity', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  310. { example: '->', actual: 'true', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  311. { example: '->', actual: 'false', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  312. { example: '->', actual: '0', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  313. { example: '->', actual: '1', result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  314. { example: '->', actual: -0, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  315. { example: '->', actual: +0, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  316. { example: '->', actual: 0, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  317. { example: '->', actual: 1, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  318. { example: '->', actual: -1.1, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  319. { example: '->', actual: true, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  320. { example: '->', actual: false, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  321. { example: '->', actual: {}, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  322. { example: '->', actual: {foo:'bar'}, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  323. { example: '->', actual: {foo:{bar:{baz:{}}}}, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  324. { example: '->', actual: {foo:['bar']}, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  325. { example: '->', actual: {foo:{bar:{baz:[{}]}}}, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  326. { example: '->', actual: [], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  327. { example: '->', actual: ['asdf'], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  328. { example: '->', actual: [''], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  329. { example: '->', actual: [235], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  330. { example: '->', actual: [false], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  331. { example: '->', actual: [{}], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  332. { example: '->', actual: [{foo:'bar'}], result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  333. { example: '->', actual: undefined, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  334. { example: '->', actual: NaN, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  335. { example: '->', actual: Infinity, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  336. { example: '->', actual: -Infinity, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  337. { example: '->', actual: null, result: function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); } },
  338. { example: '->', actual: function (inputs, exits){return exits.success();}, result: function (inputs, exits){return exits.success();} },
  339. ////////////////////////////////////////////
  340. // example: === (literally anything)
  341. // (undefined changes to '===' automatically)
  342. ////////////////////////////////////////////
  343. { example: undefined, actual: 'bar', result: 'bar', },
  344. { example: undefined, actual: '', result: '', },
  345. { example: undefined, actual: '-1.1', result: '-1.1', },
  346. { example: undefined, actual: 'NaN', result: 'NaN', },
  347. { example: undefined, actual: 'undefined', result: 'undefined', },
  348. { example: undefined, actual: 'null', result: 'null', },
  349. { example: undefined, actual: '-Infinity', result: '-Infinity', },
  350. { example: undefined, actual: 'Infinity', result: 'Infinity', },
  351. { example: undefined, actual: 'true', result: 'true', },
  352. { example: undefined, actual: 'false', result: 'false', },
  353. { example: undefined, actual: '0', result: '0', },
  354. { example: undefined, actual: '1', result: '1', },
  355. { example: undefined, actual: -0, result: -0, },
  356. { example: undefined, actual: +0, result: +0, },
  357. { example: undefined, actual: 0, result: 0, },
  358. { example: undefined, actual: 1, result: 1, },
  359. { example: undefined, actual: -1.1, result: -1.1, },
  360. { example: undefined, actual: true, result: true, },
  361. { example: undefined, actual: false, result: false, },
  362. { example: undefined, actual: {}, result: {}, },
  363. { example: undefined, actual: {foo:'bar'}, result: {foo:'bar'}, },
  364. { example: undefined, actual: {foo:{bar:{baz:{}}}}, result: {foo:{bar:{baz:{}}}}, },
  365. { example: undefined, actual: {foo:['bar']}, result: {foo:['bar']}, },
  366. { example: undefined, actual: {foo:{bar:{baz:[{}]}}}, result: {foo:{bar:{baz:[{}]}}}, },
  367. { example: undefined, actual: [], result: [], },
  368. { example: undefined, actual: ['asdf'], result: ['asdf'], },
  369. { example: undefined, actual: [''], result: [''], },
  370. { example: undefined, actual: [235], result: [235], },
  371. { example: undefined, actual: [false], result: [false], },
  372. { example: undefined, actual: [{}], result: [{}], },
  373. { example: undefined, actual: [{foo:'bar'}], result: [{foo:'bar'}], },
  374. { example: undefined, actual: undefined, result: null, },
  375. { example: undefined, actual: NaN, result: NaN, },
  376. { example: undefined, actual: Infinity, result: Infinity, },
  377. { example: undefined, actual: -Infinity, result: -Infinity, },
  378. { example: undefined, actual: null, result: null, },
  379. { example: undefined, actual: /some regexp/gi, result: /some regexp/gi },
  380. { example: undefined, actual: new Date('November 5, 1605 GMT'), result: new Date('November 5, 1605 GMT') },
  381. // $$\
  382. // \__|
  383. // $$$$$$\ $$$$$$\ $$$$$$$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$\ $$\ $$\ $$$$$$\
  384. // $$ __$$\ $$ __$$\ $$ _____|$$ | $$ |$$ __$$\ $$ _____|$$ |\$$\ $$ |$$ __$$\
  385. // $$ | \__|$$$$$$$$ |$$ / $$ | $$ |$$ | \__|\$$$$$$\ $$ | \$$\$$ / $$$$$$$$ |
  386. // $$ | $$ ____|$$ | $$ | $$ |$$ | \____$$\ $$ | \$$$ / $$ ____|
  387. // $$ | \$$$$$$$\ \$$$$$$$\ \$$$$$$ |$$ | $$$$$$$ |$$ | \$ / \$$$$$$$\
  388. // \__| \_______| \_______| \______/ \__| \_______/ \__| \_/ \_______|
  389. //
  390. //
  391. //
  392. // Some basic deep objects
  393. { example: {a:1, b:'hi', c: false}, actual: {a: 23}, result: {a: 23, b: '', c: false} },
  394. { example: {a:1, b:'hi', c: false}, actual: {a: 23, d: true}, result: {a: 23, b: '', c: false} },
  395. // Ensure that this allows extra keys when coercing to `example: {}`
  396. {
  397. example: {},
  398. actual: {a: 23, d: true},
  399. result: {a: 23, d: true}
  400. },
  401. // Omit extra keys when coercing to `example: {...}`
  402. {
  403. example: { a:23 },
  404. actual: {a: 23, d: true},
  405. result: {a: 23}
  406. },
  407. // Coerce missing/undefined required keys to base value
  408. { example: {b: 235}, actual: {b: undefined}, result: {b: 0} },
  409. { example: {b: 235}, actual: {}, result: {b: 0} },
  410. // Strip keys with `undefined` values (`{...}` case)
  411. { example: {b: 235}, actual: {a: undefined, b: 3}, result: {b: 3} },
  412. // Strip nested keys with `undefined` values (`{...}` case)
  413. { example: {a: {}, b: 235}, actual: {a: {x: undefined}, b: 3}, result: {a: {}, b: 3} },
  414. // Strip keys with `undefined` values (`{}` case)
  415. { example: {}, actual: {a: undefined, b: 3}, result: {b: 3} },
  416. // Strip nested keys with `undefined` values (`{}` case)
  417. { example: {}, actual: {a: {x: undefined}, b: 3}, result: {a: {}, b: 3} },
  418. // Don't strip keys or nested keys with `undefined` values (`===` and nested `===` cases)
  419. { example: '===', actual: {a: undefined, b: 3, c: {x: undefined}}, result: {a: undefined, b: 3, c: {x: undefined}} },
  420. { example: {c:'==='}, actual: {a: undefined, b: 3, c: {x: undefined}}, result: { c: {x: undefined}} },
  421. // Ensure that this allows arbitary arrays when coercing to `example: []`
  422. {
  423. example: [],
  424. actual: [{a: 23, d: true}],
  425. result: [{a: 23, d: true}]
  426. },
  427. // Ensure that nested dictionaries inside of an array passed
  428. // through `example: []` are stripped of keys with undefined values
  429. {
  430. example: [],
  431. actual: [{a:3, b: undefined}, {a: undefined}],
  432. result: [{a: 3},{}]
  433. },
  434. {
  435. example: [],
  436. actual: [{a:3,someStuff: [{x: undefined, y: 'foo'}, {x: 'bar', y: undefined}]},{a: 5, b: undefined}],
  437. result: [{a: 3, someStuff: [{y:'foo'}, {x:'bar'}]}, {a: 5}]
  438. },
  439. // With `===`:
  440. // Leave `undefined` items from arrays and nested arrays alone
  441. {
  442. example: '===',
  443. actual: [{a:3}, undefined, {a: 5}, undefined, {a: 7}, {a:9, b: [undefined, 9,2,4,undefined,8]}],
  444. result: [{a:3}, undefined, {a: 5}, undefined, {a: 7}, {a:9, b: [undefined, 9,2,4,undefined,8]}]
  445. },
  446. // With [`===`]:
  447. // Leave `undefined` items from NESTED arrays alone
  448. // (because they are being compared as '===')
  449. {
  450. example: ['==='],
  451. actual: [{a:3}, undefined, {a: 5}, undefined, {a: 7}, {a:9, b: [undefined, 9,2,4,undefined,8]}],
  452. result: [{a:3}, {a: 5}, {a: 7}, {a:9, b: [undefined, 9,2,4,undefined,8]}]
  453. },
  454. // Prune `undefined` items from arrays and nested arrays (`[]` case)
  455. {
  456. example: [],
  457. actual: [{a:3}, undefined, {a: 5}, undefined, {a: 7}, {a:9, b: [undefined, 9,2,4,undefined,8]}],
  458. result: [{a: 3}, {a: 5}, {a:7}, {a:9, b:[9,2,4,8]}]
  459. },
  460. // Ensure that nested dictionaries inside of an array passed
  461. // through `example: ['===']` are NOT stripped of keys with undefined values--
  462. // and are left utterly alone
  463. {
  464. example: ['==='],
  465. actual: [{a:3, b: undefined}, {a: undefined}],
  466. result: [{a: 3, b: undefined},{a:undefined}]
  467. },
  468. {
  469. example: ['==='],
  470. actual: [{a:3,someStuff: [{x: undefined, y: 'foo'}, {x: 'bar', y: undefined}]},{a: 5, b: undefined}],
  471. result: [{a:3,someStuff: [{x: undefined, y: 'foo'}, {x: 'bar', y: undefined}]},{a: 5, b: undefined}]
  472. },
  473. // Ensure the recursive cloning / undefined-key-stripping doesn't get
  474. // stumped by circular dictionaries/arrays.
  475. // • dict keys whose values point to a past reference should be deleted
  476. // • array items that point to past references should be pruned
  477. (function (){
  478. var someDict = {};
  479. var someArray = [];
  480. someDict.x = {z: someDict, foo: undefined};
  481. someDict.y = someArray;
  482. someArray.push(someDict);
  483. someArray.push(someDict.x);
  484. var test = {
  485. example: {},
  486. actual: {
  487. someDict: someDict,
  488. someArray: someArray
  489. },
  490. result: {
  491. someDict: {
  492. x: {
  493. z: '[Circular ~.someDict]'
  494. },
  495. y: [
  496. '[Circular ~.someDict]',
  497. {
  498. z: '[Circular ~.someDict]'
  499. }
  500. ]
  501. },
  502. someArray: [
  503. {
  504. x: {
  505. z: '[Circular ~.someArray.0]'
  506. },
  507. y: '[Circular ~.someArray]'
  508. },
  509. {
  510. z: {
  511. x: '[Circular ~.someArray.1]',
  512. y: '[Circular ~.someArray]'
  513. }
  514. }
  515. ]
  516. }
  517. };
  518. return test;
  519. })(),
  520. // Wholistic, complex multi-item array test
  521. {
  522. example: [{
  523. id: 123,
  524. title: 'Scott',
  525. body: 'Scott',
  526. votes: 0,
  527. resolved: true
  528. }],
  529. actual: [{
  530. votes: 10,
  531. title: 'first',
  532. resolved: false
  533. }, {
  534. votes: -5,
  535. title: 'second',
  536. resolved: false
  537. }, {
  538. votes: 0,
  539. title: 'third',
  540. resolved: false
  541. }],
  542. result: [{
  543. id: 0,
  544. votes: 10,
  545. title: 'first',
  546. body: '',
  547. resolved: false
  548. }, {
  549. id: 0,
  550. votes: -5,
  551. title: 'second',
  552. body: '',
  553. resolved: false
  554. }, {
  555. id: 0,
  556. votes: 0,
  557. title: 'third',
  558. body: '',
  559. resolved: false
  560. }]
  561. },
  562. // Complex multi-item array test w/ edge cases
  563. {
  564. example: [{
  565. id: 123,
  566. title: 'Scott',
  567. body: 'Scott',
  568. votes: 0,
  569. resolved: true
  570. }],
  571. actual: [{
  572. votes: 10,
  573. title: 'first',
  574. resolved: false
  575. }, {
  576. votes: -5,
  577. title: 'second',
  578. resolved: false
  579. }, {
  580. votes: 0,
  581. title: 'third',
  582. resolved: false
  583. },
  584. {
  585. votes: null,
  586. title: 'fourth',
  587. resolved: false
  588. },
  589. {
  590. votes: undefined,
  591. title: 'fifth',
  592. resolved: false
  593. },
  594. {
  595. title: 'sixth',
  596. resolved: false
  597. }],
  598. result: [{
  599. id: 0,
  600. votes: 10,
  601. title: 'first',
  602. body: '',
  603. resolved: false
  604. }, {
  605. id: 0,
  606. votes: -5,
  607. title: 'second',
  608. body: '',
  609. resolved: false
  610. }, {
  611. id: 0,
  612. votes: 0,
  613. title: 'third',
  614. body: '',
  615. resolved: false
  616. },
  617. {
  618. id: 0,
  619. votes: 0,
  620. title: 'fourth',
  621. body: '',
  622. resolved: false
  623. },
  624. {
  625. id: 0,
  626. votes: 0,
  627. title: 'fifth',
  628. body: '',
  629. resolved: false
  630. },
  631. {
  632. id: 0,
  633. votes: 0,
  634. title: 'sixth',
  635. body: '',
  636. resolved: false
  637. }]
  638. },
  639. // Tricky multi-item array javascript black magic
  640. {
  641. example: [{
  642. id: 123,
  643. title: 'Scott',
  644. body: 'Scott',
  645. votes: 0,
  646. resolved: true
  647. }],
  648. actual: {
  649. 0: {
  650. votes: 10,
  651. title: 'first',
  652. resolved: false
  653. },
  654. 1: {
  655. votes: -5,
  656. title: 'second',
  657. resolved: false
  658. },
  659. 2: {
  660. votes: 0,
  661. title: 'third',
  662. resolved: false
  663. },
  664. 3: {
  665. votes: null,
  666. title: 'fourth',
  667. resolved: false
  668. },
  669. 4: {
  670. votes: undefined,
  671. title: 'fifth',
  672. resolved: false
  673. },
  674. 5: {
  675. title: 'sixth',
  676. resolved: false
  677. }
  678. },
  679. result: []
  680. },
  681. // $$\ $$\ $$\ $$$\ $$$\
  682. // $$ | \__| $$ | $$ _| \$$\
  683. // $$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$ /$$$$\ $$$$\ $$$$\ \$$\
  684. // $$ _____|\_$$ _| $$ __$$\ $$ |$$ _____|\_$$ _| $$ __$$\ $$ __$$\ $$ | \____|\____|\____| $$ |
  685. // \$$$$$$\ $$ | $$ | \__|$$ |$$ / $$ | $$$$$$$$ |$$ / $$ | $$ | $$$$\ $$$$\ $$$$\ $$ |
  686. // \____$$\ $$ |$$\ $$ | $$ |$$ | $$ |$$\ $$ ____|$$ | $$ | \$$\ \____|\____|\____|$$ |
  687. // $$$$$$$ | \$$$$ |$$ | $$ |\$$$$$$$\ \$$$$ | \$$$$$$$\ \$$$$$$$ | \$$$\ $$$ /
  688. // \_______/ \____/ \__| \__| \_______| \____/ \_______| \____$$ | \___| \___/
  689. // $$ |
  690. // $$ |
  691. // \__|
  692. //
  693. // (strictEq / isNew checks to assert for and
  694. // against passing-by-reference in different
  695. // situations)
  696. ////////////////////////////////////////////////
  697. ////////////////////////////////////////////////
  698. // example: '==='
  699. // result value should always be strictly equal (===)
  700. ////////////////////////////////////////////////
  701. { example: undefined, actual: {}, strictEq: true },
  702. { example: undefined, actual: {a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}, strictEq: true },
  703. { example: undefined, actual: [], strictEq: true },
  704. { example: undefined, actual: [{a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}], strictEq: true },
  705. { example: undefined, actual: /some regexp/, strictEq: true },
  706. { example: undefined, actual: function (){}, strictEq: true },
  707. { example: undefined, actual: new Date('November 5, 1605 GMT'), strictEq: true },
  708. { example: undefined, actual: new (require('stream').Readable)(), strictEq: true },
  709. { example: undefined, actual: new Buffer('asdf'), strictEq: true },
  710. { example: undefined, actual: new Error('asdf'), strictEq: true },
  711. ////////////////////////////////////////////////////////////////////////////////////////////////
  712. // example: nested '===' in dictionaries/arrays
  713. // TODO: needs to be tested some other way, since we'd be checking reference passing within another nested obj.
  714. // also check against strict equality between sub-values (`!==` between nested things...)
  715. // This is prbly eaiest if we just pull it out into a separate test; ie. don't make the test declarative.
  716. ////////////////////////////////////////////////////////////////////////////////////////////////
  717. ////////////////////////////////////////////////
  718. // example: {} should perform a deep copy on things
  719. ////////////////////////////////////////////////
  720. { example: {}, actual: {}, isNew: true },
  721. { example: {}, actual: {a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}, isNew: true },
  722. ////////////////////////////////////////////////
  723. // example: {...} should perform a shallow copy
  724. // Assert pass-by-reference behavior for more specific `example`
  725. ////////////////////////////////////////////////
  726. {
  727. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true },
  728. actual: {},
  729. result: { id: 0, title: '', body: '', votes: 0, resolved: false },
  730. isNew: true
  731. },
  732. {
  733. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true },
  734. actual: {a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]},
  735. result: { id: 0, title: '', body: '', votes: 0, resolved: false },
  736. isNew: true
  737. },
  738. {
  739. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' },
  740. actual: {},
  741. result: { id: 0, title: '', body: '', votes: 0, resolved: false, something: null },
  742. isNew: true
  743. },
  744. {
  745. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' },
  746. actual: {a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]},
  747. result: { id: 0, title: '', body: '', votes: 0, resolved: false, something: null },
  748. isNew: true
  749. },
  750. {
  751. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' },
  752. actual: { something: new Date('November 5, 1605 GMT')},
  753. result: { id: 0, title: '', body: '', votes: 0, resolved: false, something: new Date('November 5, 1605 GMT') },
  754. isNew: true
  755. },
  756. {
  757. example: { id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' },
  758. actual: { something: new Date('November 5, 1605 GMT'), a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]},
  759. result: { id: 0, title: '', body: '', votes: 0, resolved: false, something: new Date('November 5, 1605 GMT') },
  760. isNew: true
  761. },
  762. ////////////////////////////////////////////////
  763. // example: [] should copy things
  764. ////////////////////////////////////////////////
  765. { example: [], actual: [], isNew: true },
  766. { example: [], actual: [{a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}], isNew: true },
  767. ////////////////////////////////////////////////
  768. // example: {...} should perform a shallow copy
  769. // Assert pass-by-reference behavior for more specific `example`s
  770. ////////////////////////////////////////////////
  771. {
  772. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 0, resolved: true }],
  773. actual: [],
  774. result: [],
  775. isNew: true
  776. },
  777. {
  778. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 0, resolved: true }],
  779. actual: [{a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}],
  780. result: [{ id: 0, title: '', body: '', votes: 0, resolved: false }],
  781. isNew: true
  782. },
  783. {
  784. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' }],
  785. actual: [],
  786. result: [],
  787. isNew: true
  788. },
  789. {
  790. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' }],
  791. actual: [{a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}],
  792. result: [{ id: 0, title: '', body: '', votes: 0, resolved: false, something: null }],
  793. isNew: true
  794. },
  795. {
  796. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' }],
  797. actual: [{ something: new Date('November 5, 1605 GMT')}],
  798. result: [{ id: 0, title: '', body: '', votes: 0, resolved: false, something: new Date('November 5, 1605 GMT') }],
  799. isNew: true
  800. },
  801. {
  802. example: [{ id: 123, title: 'Scott', body: 'Scott', votes: 33, resolved: true, something: '===' }],
  803. actual: [{ something: new Date('November 5, 1605 GMT'), a:23,b:'asdg',c:true,d: {x:32,y:'sagd',z: [{a:2,b:'gsda',c:false}]}, e: [2]}],
  804. result: [{ id: 0, title: '', body: '', votes: 0, resolved: false, something: new Date('November 5, 1605 GMT') }],
  805. isNew: true
  806. },
  807. ////////////////////////////////////////////////
  808. // objects which contain other crazy objects
  809. // with no `constructor` should not throw errors
  810. ////////////////////////////////////////////////
  811. {
  812. example: [{
  813. id: 123,
  814. title: 'Robinson Crusoe',
  815. surprise: {}
  816. }],
  817. actual: [{
  818. title: 'Hank the Cowdog',
  819. surprise: (function(){
  820. function Dog(){}
  821. var rover = new Dog();
  822. rover.coolProps = 'wow so cool';
  823. rover.constructo = 'hmm maybe ill try really annoying property names!';
  824. rover.prototype = null;
  825. rover.__proto__ = null;
  826. rover.constructor = null;
  827. // hehehehehhe
  828. return rover;
  829. })()
  830. }],
  831. result: [{
  832. id: 0,
  833. title: 'Hank the Cowdog',
  834. surprise: {
  835. coolProps: 'wow so cool',
  836. constructo: 'hmm maybe ill try really annoying property names!',
  837. prototype: null,
  838. constructor: null
  839. }
  840. }]
  841. }
  842. ];