orchestrator-core
Advanced tools
Comparing version 4.11.0-dev.20201021.afbe959 to 4.11.0-dev.20201021.e88b60c
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.11.0-dev.20201021.afbe959", | ||
"version": "4.11.0-dev.20201021.e88b60c", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -181,7 +181,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
assert.ok(snapshotContent.length > 0, `snapshot content length is ${snapshotContent.length}`); | ||
const labelResolver = orchestrator.createLabelResolver(snapshotContent); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: labelResolver=${labelResolver}`); | ||
console.error(`DEBUGGING - nodejs - Creating new label resolver`); | ||
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}`); | ||
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=${examples}`); | ||
console.log(`DEBUGGING - nodejs - orchestrator-core: examples.length=${examples.length}`); | ||
@@ -236,3 +243,28 @@ assert.ok(examples.length === 601, `#examples is ${examples.length}`); | ||
}); | ||
it('Add snapshot as file.', function () { | ||
// Arrange | ||
var labeler = this.orchestrator.createLabelResolver(); | ||
const example = { | ||
label: 'travel', | ||
text: 'book a flight to miami.', | ||
}; | ||
var result = labeler.addExample(example); | ||
const snapshot = labeler.createSnapshot(); | ||
const snapshot_file = 'snapshot.blu'; | ||
try { | ||
fs.unlinkSync(snapshot_file) | ||
} catch(err) { | ||
// Swallow error | ||
} | ||
fs.appendFileSync(snapshot_file, Buffer.from(snapshot)); | ||
// Act | ||
var labeler2 = this.orchestrator.createLabelResolver(); | ||
result = labeler2.addSnapshot(fs.readFileSync(snapshot_file, null)); | ||
// Assert | ||
assert.strictEqual(result, true, 'Failed to add snapshot'); | ||
}); | ||
it('Remove example.', function () { | ||
@@ -239,0 +271,0 @@ // Arrange |
Sorry, the diff of this file is not supported yet
342069
568