orchestrator-core
Advanced tools
Comparing version 4.11.0-dev.20201021.e88b60c to 4.11.0-dev.20201023.49095d1
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.11.0-dev.20201021.e88b60c", | ||
"version": "4.11.0-dev.20201023.49095d1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -145,3 +145,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
it('should succeed creating orchestrator.', function () { | ||
@@ -153,3 +152,2 @@ // Initialize Orchestrator | ||
it('should load NLR.', function () { | ||
@@ -174,3 +172,3 @@ // Initialize Orchestrator | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: __dirname=${__dirname}`); | ||
assert.ok(orchestrator.load(), 'cannot load without a NLR'); | ||
assert.ok(orchestrator.load(), 'orchestrator.load() failed'); | ||
@@ -184,12 +182,46 @@ const snapshotPath = path.join(__dirname, 'snapshot', 'Email.blu'); | ||
assert.ok(snapshotContent.length > 0, `snapshot content length is ${snapshotContent.length}`); | ||
console.error(`DEBUGGING - nodejs - Creating new label resolver`); | ||
const labelResolver = orchestrator.createLabelResolver(snapshotContent); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelResolver=${labelResolver}`); | ||
assert.ok(labelResolver !== undefined, 'cannot create a labelResolver object'); | ||
const examples = labelResolver.getExamples(); | ||
// console.log(`DEBUGGING - nodejs - orchestrator-core: examples=${examples}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: examples.length=${examples.length}`); | ||
assert.ok(examples.length === 601, `#examples is ${examples.length}`); | ||
const labels = labelResolver.getLabels(); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labels=${labels}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labels.length=${labels.length}`); | ||
assert.ok(labels.length === 15, `#labels is ${labels.length}`); | ||
const labelsIntent = labelResolver.getLabels(1); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent=${labelsIntent}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent.length=${labelsIntent.length}`); | ||
assert.ok(labelsIntent.length === 15, `#labelsIntent is ${labelsIntent.length}`); | ||
}); | ||
it('Add a snapshot test after creating an empty LabelResolver.', function () { | ||
this.timeout(1000000); | ||
const orchestrator = new oc.Orchestrator(); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: __dirname=${__dirname}`); | ||
assert.ok(orchestrator.load(), 'orchestrator.load() failed'); | ||
console.log('DEBUGGING - nodejs - orchestrator-core: ready to call OrchestratorHelper.getSnapshotFromFile()'); | ||
const snapshotPath = path.join(__dirname, 'snapshot', 'Email.blu'); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: snapshotPath=${snapshotPath}`); | ||
assert.ok(fs.existsSync(snapshotPath), `snapshot file ${snapshotPath} does not exist`); | ||
const snapshot = new TextEncoder().encode(fs.readFileSync(snapshotPath, 'utf8')); | ||
assert.ok(snapshot.length > 0, `snapshot content length is ${snapshot.length}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: typeof(snapshot)=${typeof snapshot}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: snapshot.byteLength=${snapshot.byteLength}`); | ||
console.log('DEBUGGING - nodejs - orchestrator-core: after calling OrchestratorHelper.getSnapshotFromFile()'); | ||
const labelResolver = orchestrator.createLabelResolver(); | ||
// const config = '{ "prefer_tsv_snapshot": false }'; | ||
// labelResolver.setRuntimeParams(config, true); | ||
console.error(` >>> AFTER RESOLVER`); | ||
labelResolver.addSnapshot(snapshotContent); | ||
console.error(` >>> AFTER RESOLVER2`); | ||
console.error(`DEBUGGING - nodejs - orchestrator-core: labelResolver=${labelResolver}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelResolver=${labelResolver}`); | ||
assert.ok(labelResolver !== undefined, 'cannot create a labelResolver object'); | ||
console.log('DEBUGGING - nodejs - orchestrator-core: ready to call LabelResolver.addSnapshot()'); | ||
labelResolver.addSnapshot(snapshot); | ||
console.log('DEBUGGING - nodejs - orchestrator-core: after calling LabelResolver.addSnapshot()'); | ||
const examples = labelResolver.getExamples(); | ||
@@ -196,0 +228,0 @@ // console.log(`DEBUGGING - nodejs - orchestrator-core: examples=${examples}`); |
Sorry, the diff of this file is not supported yet
345552
595