Skip to content

Commit 2d0b4d8

Browse files
committed
MLE-24976 Couple of Polaris fixes in tests
1 parent 8e4f6d8 commit 2d0b4d8

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

test-complete/nodejs-dmsdk-queryToTransformAll.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const query = q.where(ctsQb.cts.directoryQuery('/test/dataMovement/requests/tran
2121
describe('data movement transformAll - nodejs-dmsdk-queryToTransformAll', function () {
2222

2323
before(async function () {
24-
await restAdminDB.config.transforms.write(transformName, 'javascript',
24+
await restAdminDB.config.transforms.write(transformName, 'javascript',
2525
fs.createReadStream(transformPath)).result();
2626
for (let i = 0; i < 100; i++) {
2727
uris.push('/test/dataMovement/requests/transformAll/' + i + '.json');
@@ -164,7 +164,7 @@ describe('data movement transformAll - nodejs-dmsdk-queryToTransformAll', functi
164164
}
165165
});
166166
});
167-
167+
168168
summary.docsTransformedSuccessfully.should.be.equal(100);
169169
summary.docsFailedToBeTransformed.should.be.equal(0);
170170
summary.timeElapsed.should.be.greaterThanOrEqual(0);
@@ -195,12 +195,12 @@ describe('data movement transformAll - nodejs-dmsdk-queryToTransformAll', functi
195195
summary.docsTransformedSuccessfully.should.be.equal(100);
196196
summary.docsFailedToBeTransformed.should.be.equal(0);
197197
summary.timeElapsed.should.be.greaterThanOrEqual(0);
198-
198+
199199
await verifyDocs('transformedValue');
200200
});
201201

202202
it('should queryToTransformAll documents with onCompletion option', async function () {
203-
const summary = await new Promise((resolve, reject) => {
203+
const summary = await new Promise((resolve, reject) => {
204204
dbWriter.documents.queryToTransformAll(query, {
205205
transform: [transformName, { newValue: 'transformedValue' }],
206206
onCompletion: ((summary) => {
@@ -220,7 +220,7 @@ describe('data movement transformAll - nodejs-dmsdk-queryToTransformAll', functi
220220
});
221221

222222
it('should work with batchSize less than 1', async function () {
223-
const summary = await new Promise((resolve, reject) => {
223+
const summary = await new Promise((resolve, reject) => {
224224
dbWriter.documents.queryToTransformAll(query, {
225225
transform: [transformName, { newValue: 'transformedValue' }],
226226
batchSize: 0,
@@ -296,8 +296,10 @@ describe('data movement transformAll - nodejs-dmsdk-queryToTransformAll', functi
296296

297297
async function verifyDocs(value) {
298298
const documents = await dbWriter.documents.read(uris).result();
299+
should.exist(documents);
300+
documents.should.be.an.Array();
299301
documents.length.should.equal(100);
300302
for (let i = 0; i < documents.length; i++) {
301303
documents[i].content.key.should.equal(value);
302304
}
303-
}
305+
}

test-complete/nodejs-documents-read-chunk.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const dbAdmin = marklogic.createDatabaseClient(testconfig.restAdminConnection);
2121
describe('Binary documents test', function () {
2222
const binaryPath = __dirname + '/data/somePdfFile.pdf';
2323
let binaryValue = null;
24-
24+
2525
const uri = '/test/binary/somePdfFile.pdf';
2626

2727
before(async function () {
@@ -46,27 +46,28 @@ describe('Binary documents test', function () {
4646
content: readableBinary
4747
}).result();
4848

49+
should.exist(response);
4950
response.should.have.property('documents');
5051

5152
const streamData = await new Promise((resolve, reject) => {
5253
const chunks = [];
5354
const readStream = dbReader.documents.read(uri).stream('chunked');
54-
55+
5556
readStream.on('data', function (data) {
5657
chunks.push(data);
5758
});
58-
59+
5960
readStream.on('end', function () {
6061
resolve(Buffer.concat(chunks));
6162
});
62-
63+
6364
readStream.on('error', function (error) {
6465
reject(error);
6566
});
6667
});
6768

6869
Buffer.compare(binaryValue, streamData).should.equal(0);
69-
70+
7071
// Verify the binary content has a string near the end of the file
7172
const strData = streamData.toString();
7273
strData.should.containEql('CVISION Technologies');

0 commit comments

Comments
 (0)