1
0
Fork 0

Foxx: Repository tests pulled out

This commit is contained in:
Lucas Dohmen 2013-08-05 13:33:06 +02:00
parent e34683c57c
commit 6cef711a7b
4 changed files with 42 additions and 35 deletions

View File

@ -314,6 +314,7 @@ SHELL_SERVER_ONLY = \
@top_srcdir@/js/server/tests/transactions.js \
@top_srcdir@/js/server/tests/routing.js \
@top_srcdir@/js/common/tests/shell-foxx.js \
@top_srcdir@/js/common/tests/shell-foxx-repository.js \
@top_srcdir@/js/common/tests/shell-graph-traversal.js \
@top_srcdir@/js/common/tests/shell-graph-algorithms.js \
@top_srcdir@/js/common/tests/shell-graph-measurement.js \

View File

@ -0,0 +1,40 @@
require("internal").flushModuleCache();
var jsunity = require("jsunity"),
FoxxRepository = require('org/arangodb/foxx/repository').Repository;
function RepositorySpec () {
var TestRepository, instance, prefix, collection, modelPrototype;
return {
setUp: function () {
prefix = "myApp";
collection = function () {};
modelPrototype = function () {};
},
testWasInitialized: function () {
instance = new FoxxRepository(prefix, collection, modelPrototype);
assertEqual(instance.prefix, prefix);
assertEqual(instance.collection, collection);
assertEqual(instance.modelPrototype, modelPrototype);
},
testAddingAMethodWithExtend: function () {
TestRepository = FoxxRepository.extend({
test: function() {
return "test";
}
});
instance = new TestRepository(prefix, collection, modelPrototype);
assertEqual(instance.test(), "test");
}
};
}
jsunity.run(RepositorySpec);
return jsunity.done();

View File

@ -842,39 +842,6 @@ function ModelSpec () {
};
}
function RepositorySpec () {
var FoxxRepository, TestRepository, instance, prefix, collection, modelPrototype;
return {
setUp: function () {
FoxxRepository = require('org/arangodb/foxx').Repository;
prefix = "myApp";
collection = function () {};
modelPrototype = function () {};
},
testWasInitialized: function () {
instance = new FoxxRepository(prefix, collection, modelPrototype);
assertEqual(instance.prefix, prefix);
assertEqual(instance.collection, collection);
assertEqual(instance.modelPrototype, modelPrototype);
},
testAddingAMethodWithExtend: function () {
TestRepository = FoxxRepository.extend({
test: function() {
return "test";
}
});
instance = new TestRepository(prefix, collection, modelPrototype);
assertEqual(instance.test(), "test");
}
};
}
jsunity.run(CreateFoxxApplicationSpec);
jsunity.run(SetRoutesFoxxApplicationSpec);
jsunity.run(DocumentationAndConstraintsSpec);
@ -884,6 +851,5 @@ jsunity.run(BaseMiddlewareWithTemplateSpec);
jsunity.run(ViewHelperSpec);
jsunity.run(FormatMiddlewareSpec);
jsunity.run(ModelSpec);
jsunity.run(RepositorySpec);
return jsunity.done();

View File

@ -2,7 +2,7 @@
/*global module, require, exports */
////////////////////////////////////////////////////////////////////////////////
/// @brief Foxx application
/// @brief Foxx Repository
///
/// @file
///