graph-common
Version:
Open Graph API core js lib
55 lines (48 loc) • 1.55 kB
JavaScript
(function() {
'use strict';
var ConfigurationManager, Graph, Query, should;
should = require('should');
ConfigurationManager = require('../../lib/configuration_manager');
Graph = require('../../lib/graph');
Query = require('../../lib/query');
describe('Graph', function() {
return describe('create and run query', function() {
return it('should create graph and run gql script', function(done) {
var cm, data, graph, query;
cm = new ConfigurationManager({
name: "Open Graph API",
di: {
StorageManager: './storage_manager',
NodeManager: './node_manager',
RouteManager: './route_manager',
GQL: './gql'
},
StorageManager: "mongodb://localhost/graph",
NodeManager: {
"node/one": {
name: "node/one",
router: 'EchoRouter'
}
},
RouteManager: {
"EchoRouter": {
name: "EchoRouter",
require: "./echo_router"
}
}
});
graph = new Graph(cm);
graph.should.be["instanceof"](Graph);
should(graph.route_manager).be;
should(graph.node_manager).be;
should(graph.storage_manager).be;
data = '{ "test": "value" }';
query = new Query('node/one', 'create', data);
return graph.query(query, function(query) {
data.should.equal(query.data);
return done();
});
});
});
});
}).call(this);