Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions test-basic/fromDocDescriptors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const testlib = require("../etc/test-lib");
const db = marklogic.createDatabaseClient(testconfig.restAdminConnection);
const op = marklogic.planBuilder;
let serverConfiguration = {};
const assert = require('assert');
describe('optic-update fromDocDescriptors tests', function() {
this.timeout(10000);
before(function (done) {
Expand Down Expand Up @@ -128,12 +129,16 @@ describe('optic-update fromDocDescriptors tests', function() {
});

it('test with wrong type of argument', function (done) {
try {
db.rows.query(op.fromDocDescriptors('asd'))
} catch (e) {
e.toString().includes('Error: doc-descriptor argument at 0 of PlanBuilder.fromDocDescriptors() must be a PlanDocDescriptor value');
done();
}
db.rows.query(op.fromDocDescriptors('asd'))
.catch(error => {
try{
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Missing space before opening brace. Should be 'try {' to maintain consistent code formatting.

Suggested change
try{
try {

Copilot uses AI. Check for mistakes.
assert(error.body.errorResponse.message.toString()
.includes('Invalid arguments: fromDocDescriptors - expects an array/sequence or object as input.'))
done();
} catch(error){
done(error);
}
})
});

it('test with one doc descriptor', function (done) {
Expand Down
4 changes: 2 additions & 2 deletions test-complete/nodejs-graphs-content-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ describe('content type graph test', function () {
result(function (response) {
//console.log(JSON.stringify(response, null, 2));
response.should.containEql('<title>SPARQL results</title>');
response.should.containEql('<a href=\"/v1/graphs/things?iri=http%3a//marklogicsparql.com/id%231111\">http://marklogicsparql.com/id#1111</a>');
response.toString().includes('<a href=\"/v1/graphs/things?iri=http%3a//marklogicsparql.com/id%231111\">http://marklogicsparql.com/id#1111</a>');
done();
}, done);
}).catch(error => done(error));
});

it('should run SPARQL query with n-triples content type', function (done) {
Expand Down
19 changes: 3 additions & 16 deletions test-complete/nodejs-optic-generate-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ const dbClient = marklogic.createDatabaseClient(

const pb = marklogic.planBuilder;

function waitForViewCreate(wTime) {
return it('View creation delay', done => {
setTimeout(() => done(), wTime);

}).timeout(wTime + 120);
}

describe('Nodejs Optic generate views test', function () {
this.timeout(20000);
Expand Down Expand Up @@ -89,13 +83,11 @@ describe('Nodejs Optic generate views test', function () {
content: res
}).
result(function (response) {
// console.log(JSON.stringify(response, null, 4));
done();
setTimeout(()=> done(), 10120);
});
}).catch(error=>done(error));
});

waitForViewCreate(10000);

it('TEST 1a - Verify InnerJoin keymatch view', function (done) {
const qv = pb.fromView('InnerJoin', 'keymatch');
Expand Down Expand Up @@ -145,13 +137,11 @@ describe('Nodejs Optic generate views test', function () {
content: res
}).
result(function (response) {
// console.log(JSON.stringify(response, null, 4));
done();
setTimeout(()=> done(), 10120);
});
}).catch(error=>done(error));
});

waitForViewCreate(10000);

it('TEST 2a - Verify sparql groupmin view', function (done) {
const qv = pb.fromView('sparql', 'groupmin');
Expand Down Expand Up @@ -204,14 +194,11 @@ describe('Nodejs Optic generate views test', function () {
content: res
}).
result(function (response) {
// console.log(JSON.stringify(response, null, 4));
done();
setTimeout(()=> done(), 10120);
});
}).catch(error=>done(error));
});

waitForViewCreate(10000);

it('TEST 3a - Verify sparql groupmin view', function (done) {
const qv = pb.fromView('lexicons', 'orderbyselect');

Expand Down
2 changes: 1 addition & 1 deletion test-complete/nodejs-optic-nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('Nodejs Optic nodes json constructor test', function () {
expect(output.rows[3]['myItem.rowId']).to.equal(4);
expect(output.rows[3].xml).to.equal('<root attrA="4"><elemA>red</elemA><!--this is a comment for hoop--><elemB>hoop</elemB></root>');
done();
}, done);
}).catch(error => done(error));
});

it('TEST 2 - construct json from views', function (done) {
Expand Down
Loading