Skip to content

Instantly share code, notes, and snippets.

@phpnode
Created May 14, 2014 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpnode/a105250d6d0d311543b4 to your computer and use it in GitHub Desktop.
Save phpnode/a105250d6d0d311543b4 to your computer and use it in GitHub Desktop.
describe.only("Bug #56: process out of memory", function () {
before(function () {
this.db = TEST_SERVER.use('Security', 'plocal');
this.queryText = "select *, map( 'schoolLocations', $slocs, 'governingInstitutions', $gis, 'clbs', $clbs, 'schoolCommunities', $scs, 'mainStructures', $mss ) as relations from School let slocE = outE()[ @class = 'controls' ], giE = inE()[ @class = 'controls' ], scE = inE()[ @class = 'controls' ], clbE = inE()[ @class = 'provides_services_for' ], msE = outE()[ @class = 'has_property' ], locs = list( (select format( '/schoollocations/%s', in.key ) as href, startDate, endDate from $slocE where in.@class = 'SchoolLocation' ) ), gis = list( (select format( '/governinginstitutions/%s', out.key ) as href, startDate, endDate from $giE where out.@class = 'GoverningInstitution' ) ), scs = list( (select format( '/schoolcommunities/%s', out.institutionNumber ) as href, startDate, endDate from $scE where out.@class = 'SchoolCommunity' ) ), clbs = list( (select format( '/clbs/%s', out.institutionNumber ) as href, startDate, endDate from $clbE where out.@class = 'Clb' ) ), mss = list( (select format( '/mainstructures/%s', out.nr ) as href, startDate, endDate from $msE where in.@class = 'MainStructure' ) ) where key = 'a2a3e1be-a3a4-11e3-ace8-005056872b95'";
});
it('should execute a complicated query', function () {
return this.db.query(this.queryText)
.spread(function (result) {
result.status.should.equal('ACTIVE');
result.out_has_property.should.be.an.instanceOf(LIB.Bag);
result.in_provides_services_for.should.be.an.instanceOf(LIB.RID);
});
});
it('should execute a complicated query, with a fetch plan', function () {
return this.db.query(this.queryText, {
fetchPlan: '*:1'
})
.spread(function (result) {
result.in_provides_services_for.should.be.type('object');
result.in_provides_services_for['@rid'].should.be.an.instanceOf(LIB.RID);
console.log(result.in_provides_services_for);
});
});
it('should execute a complicated query, with a deep fetch plan', function () {
return this.db.query(this.queryText, {
fetchPlan: '*:5'
})
.spread(function (result) {
result.in_provides_services_for.should.be.type('object');
result.in_provides_services_for['@rid'].should.be.an.instanceOf(LIB.RID);
console.log(result.in_provides_services_for);
});
});
it('should execute a complicated query, with a fetch plan', function () {
return this.db.exec(this.queryText, {
fetchPlan: '*:1'
})
.then(function (results) {
results.results.length.should.be.above(2);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment