diff --git a/js/server/tests/replication-data.js b/js/server/tests/replication-data.js index 87ba401b09..1c5e9462b7 100644 --- a/js/server/tests/replication-data.js +++ b/js/server/tests/replication-data.js @@ -1,4 +1,4 @@ -/*global require, assertEqual, assertTrue, arango */ +/*global require, fail, assertEqual, assertTrue, assertFalse, assertNull, arango */ //////////////////////////////////////////////////////////////////////////////// /// @brief test the replication @@ -47,6 +47,7 @@ var slaveEndpoint = masterEndpoint.replace(/:3(\d+)$/, ':4$1'); //////////////////////////////////////////////////////////////////////////////// function ReplicationSuite () { + "use strict"; var cn = "UnitTestsReplication"; var cn2 = "UnitTestsReplication2"; @@ -72,19 +73,20 @@ function ReplicationSuite () { }; var compareTicks = function (l, r) { + var i; if (l === null) { l = "0"; } if (r === null) { r = "0"; } - if (l.length != r.length) { + if (l.length !== r.length) { return l.length - r.length < 0 ? -1 : 1; } // length is equal for (i = 0; i < l.length; ++i) { - if (l[i] != r[i]) { + if (l[i] !== r[i]) { return l[i] < r[i] ? -1 : 1; } } @@ -474,7 +476,11 @@ function ReplicationSuite () { var c = db._create(cn), i; for (i = 0; i < 1000; ++i) { - c.save({ "value" : i, "foo" : true, "bar" : [ i , false ], "value2" : null, "mydata" : { "test" : [ "abc", "def" ] } }); + c.save({ "value" : i, + "foo" : true, + "bar" : [ i , false ], + "value2" : null, + "mydata" : { "test" : [ "abc", "def" ] } }); } state.checksum = collectionChecksum(cn); @@ -500,10 +506,10 @@ function ReplicationSuite () { for (i = 0; i < 1000; ++i) { c.save({ "abc" : true, "_key" : "test" + i }); - if (i % 3 == 0) { + if (i % 3 === 0) { c.remove(c.last()); } - else if (i % 5 == 0) { + else if (i % 5 === 0) { c.update("test" + i, { "def" : "hifh" }); } } @@ -581,10 +587,10 @@ function ReplicationSuite () { for (i = 0; i < 100; ++i) { c.save({ "abc" : true, "_key" : "test" + i }); - if (i % 3 == 0) { + if (i % 3 === 0) { c.remove(c.last()); } - else if (i % 5 == 0) { + else if (i % 5 === 0) { c.update("test" + i, { "def" : "hifh" }); } } @@ -815,7 +821,7 @@ function ReplicationSuite () { c.save({ "_key" : "test" + i, value : i }); c.update("test" + i, { value : i + 1 }); - if (i % 5 == 0) { + if (i % 5 === 0) { c.remove("test" + i); } } @@ -1264,7 +1270,7 @@ function ReplicationSuite () { /// @brief test unique constraint //////////////////////////////////////////////////////////////////////////////// - testUniqueConstraint : function () { + testUniqueConstraint2 : function () { compare( function (state) { var c = db._create(cn), i; diff --git a/js/server/tests/shell-cluster-agency.js b/js/server/tests/shell-cluster-agency.js index 021936cdf4..b978584791 100644 --- a/js/server/tests/shell-cluster-agency.js +++ b/js/server/tests/shell-cluster-agency.js @@ -1,3 +1,6 @@ +/*jshint strict: true */ +/*global require, fail, assertFalse, assertTrue, assertEqual, assertNotEqual, assertMatch, ArangoAgency */ + //////////////////////////////////////////////////////////////////////////////// /// @brief test the agency communication layer /// @@ -36,6 +39,7 @@ var jsunity = require("jsunity"); //////////////////////////////////////////////////////////////////////////////// function AgencySuite () { + "use strict"; var agency = ArangoAgency; var oldPrefix = agency.prefix(true); @@ -334,7 +338,7 @@ function AgencySuite () { // overwrite agency.set("UnitTestsAgency/foo", "test2", 2); - var values = agency.get("UnitTestsAgency/foo"); + values = agency.get("UnitTestsAgency/foo"); assertTrue(values.hasOwnProperty("UnitTestsAgency/foo")); assertEqual(values["UnitTestsAgency/foo"], "test2"); @@ -342,13 +346,13 @@ function AgencySuite () { // re-insert agency.set("UnitTestsAgency/foo", "test3"); - var values = agency.get("UnitTestsAgency/foo"); + values = agency.get("UnitTestsAgency/foo"); assertTrue(values.hasOwnProperty("UnitTestsAgency/foo")); assertEqual(values["UnitTestsAgency/foo"], "test3"); // update with ttl agency.set("UnitTestsAgency/foo", "test4", 2); - var values = agency.get("UnitTestsAgency/foo"); + values = agency.get("UnitTestsAgency/foo"); assertTrue(values.hasOwnProperty("UnitTestsAgency/foo")); assertEqual(values["UnitTestsAgency/foo"], "test4"); diff --git a/js/server/tests/shell-foxx-repository-spec.js b/js/server/tests/shell-foxx-repository-spec.js index be5e5a10ad..e758323b1c 100644 --- a/js/server/tests/shell-foxx-repository-spec.js +++ b/js/server/tests/shell-foxx-repository-spec.js @@ -1,5 +1,33 @@ /*global require, describe, beforeEach, it, expect, spyOn, createSpy, createSpyObj */ +//////////////////////////////////////////////////////////////////////////////// +/// @brief simple queries +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2014 ArangoDB GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is ArangoDB GmbH, Cologne, Germany +/// +/// @author Lucas Dohmen +/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + var FoxxRepository = require("org/arangodb/foxx/repository").Repository, Model = require("org/arangodb/foxx/model").Model; diff --git a/js/server/tests/shell-production.js b/js/server/tests/shell-production.js index fabb9d0166..1a1faac58b 100644 --- a/js/server/tests/shell-production.js +++ b/js/server/tests/shell-production.js @@ -1,3 +1,5 @@ +/*jshint strict: true */ +/*global require, assertEqual */ //////////////////////////////////////////////////////////////////////////////// /// @brief tests for production mode /// @@ -33,7 +35,7 @@ var jsunity = require("jsunity"); //////////////////////////////////////////////////////////////////////////////// function productionTestSuite () { - + "use strict"; return { //////////////////////////////////////////////////////////////////////////////// diff --git a/js/server/tests/shell-skiplist-rm-performance-timecritical.js b/js/server/tests/shell-skiplist-rm-performance-timecritical.js index 61377ec2af..4f83fc2676 100644 --- a/js/server/tests/shell-skiplist-rm-performance-timecritical.js +++ b/js/server/tests/shell-skiplist-rm-performance-timecritical.js @@ -1,4 +1,4 @@ -/*global require, db, assertEqual, assertTrue, ArangoCollection */ +/*global require, assertFalse */ //////////////////////////////////////////////////////////////////////////////// /// @brief test the performance of removal with a skip-list index @@ -39,6 +39,7 @@ var internal = require("internal"); //////////////////////////////////////////////////////////////////////////////// function SkipListPerfSuite() { + "use strict"; var cn = "UnitTestsCollectionSkiplistPerf"; var collection = null; @@ -75,39 +76,39 @@ function SkipListPerfSuite() { //////////////////////////////////////////////////////////////////////////////// testDeletionPerformance : function () { - var time = require("internal").time; - collection.ensureSkiplist("value"); - var N=100000; - var p=14777; // must be coprime to N - for (i = 0;i < N;i++) { - collection.save({value:i}); - }; - var l = collection.toArray(); - var t = time(); - var j = 0; - var x; - for (var i = 0;i < l.length;i++) { - x = l[j]; - j = (j+p) % l.length; - collection.remove(x._key) - }; - var t1 = time()-t; - internal.db._drop(cn); - collection = internal.db._create(cn); - collection.ensureSkiplist("value"); - for (i = 0;i < N;i++) { - collection.save({value: i % 10}); - }; - l = collection.toArray(); - t = time(); - j = 0; - for (i = 0;i < l.length;i++) { - x = l[j]; - j = (j+p) % l.length; - collection.remove(x._key) - }; - t2 = time()-t; - assertFalse(t2 > 5*t1,"Removal with skip-list index is slow"); + var time = require("internal").time; + collection.ensureSkiplist("value"); + var N=100000; + var p=14777; // must be coprime to N + for (i = 0;i < N;i++) { + collection.save({value:i}); + } + var l = collection.toArray(); + var t = time(); + var j = 0; + var x; + for (var i = 0;i < l.length;i++) { + x = l[j]; + j = (j+p) % l.length; + collection.remove(x._key); + } + var t1 = time()-t; + internal.db._drop(cn); + collection = internal.db._create(cn); + collection.ensureSkiplist("value"); + for (i = 0;i < N;i++) { + collection.save({value: i % 10}); + } + l = collection.toArray(); + t = time(); + j = 0; + for (i = 0;i < l.length;i++) { + x = l[j]; + j = (j+p) % l.length; + collection.remove(x._key); + } + var t2 = time()-t; + assertFalse(t2 > 5*t1,"Removal with skip-list index is slow"); } };