orchestrator-core
Advanced tools
Comparing version 4.10.0-dev.20200813.b4c114e to 4.10.0-dev.20200814.975fe7b
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.10.0-dev.20200813.b4c114e", | ||
"version": "4.10.0-dev.20200814.975fe7b", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -83,3 +83,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Executed once for this overall suite. | ||
before(async function () { | ||
before(function () { | ||
this.timeout(100000); | ||
@@ -99,29 +99,32 @@ this.orchestrator = new oc.Orchestrator(); | ||
assert.notEqual(nlr, null, 'Orchestrator could not be created'); | ||
}); | ||
it('should load NLR.', async function () { | ||
it('should load NLR.', function () { | ||
// Initialize Orchestrator | ||
this.timeout(60000); | ||
const nlr = new oc.Orchestrator(); | ||
const result = await nlr.loadAsync(); | ||
const result = nlr.load(); | ||
assert.strictEqual(result, true, 'Failed async load'); | ||
}); | ||
it('should fail load bad type.', async function () { | ||
it('should throw load() method must provide valid path to NLR.', async function () { | ||
// Initialize Orchestrator | ||
this.timeout(600); | ||
expected = TypeError; | ||
const nlr = new oc.Orchestrator(); | ||
await assert.rejects( async () => { await nlr.loadAsync(234); }, expected, "Rejects on invalid directory type" ); | ||
assert.throws(() => { nlr.load(234); }, "TypeError: load() method must provide valid path to NLR." ); | ||
}); | ||
it('should create a LabelResolver without a NLR nodel, but with a BLU snapshot.', async function () { | ||
it('should create a LabelResolver without a NLR nodel, but with a BLU snapshot.', function () { | ||
this.timeout(10000); | ||
const orchestrator = new oc.Orchestrator(); | ||
assert.ok(orchestrator.load(), 'cannot load without a NLR'); | ||
const snapshotPath = path.join(__dirname, 'snapshot', 'Email.blu'); | ||
assert.ok(fs.existsSync(snapshotPath), `snapshot file ${snapshotPath} does not exist`); | ||
const snapshotContent = new TextEncoder().encode(fs.readFileSync(snapshotPath)); | ||
assert.ok(snapshotContent.length === 140732, `snapshot content length is ${snapshotContent.length}`); | ||
const labelResolver = await orchestrator.createLabelResolver(snapshotContent); | ||
assert.ok(snapshotContent.length > 0, `snapshot content length is ${snapshotContent.length}`); | ||
const labelResolver = orchestrator.createLabelResolver(snapshotContent); | ||
assert.ok(labelResolver !== undefined, 'cannot create a labelResolver object'); | ||
@@ -131,11 +134,10 @@ const examples = labelResolver.getExamples(); | ||
}); | ||
it('should fail load bad path.', async function () { | ||
it('should throw Invalid JSON config or path provided', function () { | ||
this.timeout(10000); | ||
expected = Error; | ||
const nlr = new oc.Orchestrator(); | ||
await assert.rejects( async () => { await nlr.loadAsync('/foo/bar/path'); }, expected, "Rejects on invalid directory" ); | ||
assert.throws(() => { nlr.load('/foo/bar/path'); }, /^TypeError: Invalid JSON config or path provided .*/); | ||
}); | ||
it('should fail load - invalid config file.', async function () { | ||
it('should throw Invalid config JSON syntax in config file:.', function () { | ||
this.timeout(10000); | ||
@@ -145,6 +147,6 @@ expected = Error; | ||
const bad_config = path.join(__dirname, 'bad_config'); | ||
assert.throws(() => nlr.load(bad_config), /^TypeError: Invalid config JSON syntax in config file: .*/); | ||
assert.throws(() => { nlr.load(bad_config); }, /^TypeError: Invalid config JSON syntax in config file: .*/); | ||
}); | ||
it('should fail load - no config file.', async function () { | ||
it('should fail load - no config file.', function () { | ||
this.timeout(10000); | ||
@@ -157,3 +159,3 @@ expected = Error; | ||
it('Add example.', async function () { | ||
it('Add example.', function () { | ||
// Arrange | ||
@@ -171,3 +173,3 @@ var labeler = this.orchestrator.createLabelResolver(); | ||
it('Remove example.', async function () { | ||
it('Remove example.', function () { | ||
// Arrange | ||
@@ -193,3 +195,3 @@ var orc = new oc.Orchestrator(); | ||
}); | ||
it('Add example - complex label.', async function () { | ||
it('Add example - complex label.', function () { | ||
// Arrange | ||
@@ -196,0 +198,0 @@ var labeler = this.orchestrator.createLabelResolver(); |
Sorry, the diff of this file is not supported yet
461988
324