j2c
Version:
80 lines (69 loc) • 3.12 kB
JavaScript
// //tests
// o.spec('Extras: ', function() {
// var j2c
// o.beforeEach(function(){
// // ensure that we are not sensitive to additions to Object.prototype.
// Object.prototype.BADBAD = 5
// j2c = new J2c()
// })
// o.afterEach(function() {
// delete Object.prototype.BADBAD
// })
// o('j2c.kv()', function() {
// o(j2c.kv instanceof Function).equals(true)('value should have been a Function')
// var res = j2c.kv('k', 'v')
// o(res.hasOwnProperty('k')).equals(true)
// o(res.k).equals('v')
// })
// o('j2c.global()', function() {
// o(j2c.global instanceof Function).equals(true)('value should have been a Function')
// o(j2c.global('foo')).equals(':global(foo)')
// })
// o('j2c.at(), basics', function() {
// o(j2c.at instanceof Function).equals(true)('value should have been a Function')
// })
// o('j2c.at(), as an object key', function() {
// o(j2c.at('foo', 'bar') + '').equals('@foo bar')
// })
// o('j2c.at(), as an object key, curried', function() {
// o(j2c.at('foo')('bar') + '').equals('@foo bar')
// o(j2c.at('foo')()('bar') + '').equals('@foo bar')
// o(j2c.at('foo')('bar')() + '').equals('@foo bar')
// })
// o('j2c.at(), as an object generator', function() {
// var atFoo = j2c.at('foo', 'bar', {
// baz: 'qux'
// })
// o(atFoo.hasOwnProperty('@foo bar')).equals(true)
// o(atFoo['@foo bar'] instanceof Object).equals(true)('value should have been a Object')
// o(atFoo['@foo bar'].hasOwnProperty('baz')).equals(true)
// o(atFoo['@foo bar'].baz).equals('qux')
// })
// o('j2c.at(), as an object generator, curried 1', function() {
// var atFoo = j2c.at('foo')('bar', {
// baz: 'qux'
// })
// o(atFoo.hasOwnProperty('@foo bar')).equals(true)
// o(atFoo['@foo bar'] instanceof Object).equals(true)('value should have been a Object')
// o(atFoo['@foo bar'].hasOwnProperty('baz')).equals(true)
// o(atFoo['@foo bar'].baz).equals('qux')
// })
// o('j2c.at(), as an object generator, curried 2', function() {
// var atFoo = j2c.at('foo', 'bar')({
// baz: 'qux'
// })
// o(atFoo.hasOwnProperty('@foo bar')).equals(true)
// o(atFoo['@foo bar'] instanceof Object).equals(true)('value should have been a Object')
// o(atFoo['@foo bar'].hasOwnProperty('baz')).equals(true)
// o(atFoo['@foo bar'].baz).equals('qux')
// })
// o('J2c.at(), as an object generator, curried 3', function() {
// var atFoo = j2c.at('foo')('bar')({
// baz: 'qux'
// })
// o(atFoo.hasOwnProperty('@foo bar')).equals(true)
// o(atFoo['@foo bar'] instanceof Object).equals(true)('value should have been a Object')
// o(atFoo['@foo bar'].hasOwnProperty('baz')).equals(true)
// o(atFoo['@foo bar'].baz).equals('qux')
// })
// })