mirror of https://gitee.com/bigwinds/arangodb
Foxx: Repository tests pulled out
This commit is contained in:
parent
e34683c57c
commit
6cef711a7b
|
@ -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 \
|
||||
|
|
|
@ -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();
|
|
@ -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();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*global module, require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Foxx application
|
||||
/// @brief Foxx Repository
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue