diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/storefunc.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/storefunc.js')
-rw-r--r-- | jstests/core/storefunc.js | 93 |
1 files changed, 54 insertions, 39 deletions
diff --git a/jstests/core/storefunc.js b/jstests/core/storefunc.js index fae9e58bfa4..8598e9cc62b 100644 --- a/jstests/core/storefunc.js +++ b/jstests/core/storefunc.js @@ -4,42 +4,57 @@ var res; s = testdb.system.js; s.remove({}); -assert.eq( 0 , s.count() , "setup - A" ); - -res = s.save( { _id : "x" , value : "3" } ); -assert( !res.hasWriteError() , "setup - B" ); -assert.eq( 1 , s.count() , "setup - C" ); - -s.remove( { _id : "x" } ); -assert.eq( 0 , s.count() , "setup - D" ); -s.save( { _id : "x" , value : "4" } ); -assert.eq( 1 , s.count() , "setup - E" ); - -assert.eq( 4 , s.findOne( { _id : "x" } ).value , "E2 " ); - -assert.eq( 4 , s.findOne().value , "setup - F" ); -s.update( { _id : "x" } , { $set : { value : 5 } } ); -assert.eq( 1 , s.count() , "setup - G" ); -assert.eq( 5 , s.findOne().value , "setup - H" ); - -assert.eq( 5 , testdb.eval( "return x" ) , "exec - 1 " ); - -s.update( { _id : "x" } , { $set : { value : 6 } } ); -assert.eq( 1 , s.count() , "setup2 - A" ); -assert.eq( 6 , s.findOne().value , "setup - B" ); - -assert.eq( 6 , testdb.eval( "return x" ) , "exec - 2 " ); - - - -s.insert( { _id : "bar" , value : function( z ){ return 17 + z; } } ); -assert.eq( 22 , testdb.eval( "return bar(5);" ) , "exec - 3 " ); - -assert( s.getIndexKeys().length > 0 , "no indexes" ); -assert( s.getIndexKeys()[0]._id , "no _id index" ); - -assert.eq( "undefined" , testdb.eval( function(){ return typeof(zzz); } ) , "C1" ); -s.save( { _id : "zzz" , value : 5 } ); -assert.eq( "number" , testdb.eval( function(){ return typeof(zzz); } ) , "C2" ); -s.remove( { _id : "zzz" } ); -assert.eq( "undefined" , testdb.eval( function(){ return typeof(zzz); } ) , "C3" ); +assert.eq(0, s.count(), "setup - A"); + +res = s.save({_id: "x", value: "3"}); +assert(!res.hasWriteError(), "setup - B"); +assert.eq(1, s.count(), "setup - C"); + +s.remove({_id: "x"}); +assert.eq(0, s.count(), "setup - D"); +s.save({_id: "x", value: "4"}); +assert.eq(1, s.count(), "setup - E"); + +assert.eq(4, s.findOne({_id: "x"}).value, "E2 "); + +assert.eq(4, s.findOne().value, "setup - F"); +s.update({_id: "x"}, {$set: {value: 5}}); +assert.eq(1, s.count(), "setup - G"); +assert.eq(5, s.findOne().value, "setup - H"); + +assert.eq(5, testdb.eval("return x"), "exec - 1 "); + +s.update({_id: "x"}, {$set: {value: 6}}); +assert.eq(1, s.count(), "setup2 - A"); +assert.eq(6, s.findOne().value, "setup - B"); + +assert.eq(6, testdb.eval("return x"), "exec - 2 "); + +s.insert({ + _id: "bar", + value: function(z) { + return 17 + z; + } +}); +assert.eq(22, testdb.eval("return bar(5);"), "exec - 3 "); + +assert(s.getIndexKeys().length > 0, "no indexes"); +assert(s.getIndexKeys()[0]._id, "no _id index"); + +assert.eq("undefined", + testdb.eval(function() { + return typeof(zzz); + }), + "C1"); +s.save({_id: "zzz", value: 5}); +assert.eq("number", + testdb.eval(function() { + return typeof(zzz); + }), + "C2"); +s.remove({_id: "zzz"}); +assert.eq("undefined", + testdb.eval(function() { + return typeof(zzz); + }), + "C3"); |