Skip to content

Commit

Permalink
syncLabelResolverEx should return after addBatch (#1266)
Browse files Browse the repository at this point in the history
* Update build.ts

Return after addBatch

* Update create.test.ts
  • Loading branch information
tsuwandy committed Jul 8, 2021
1 parent cf471cf commit f16ca8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/orchestratorlib/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class OrchestratorBuild {
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), ready to call LabelResolver.addBatch()');
LabelResolver.addBatch(target);
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), after calling LabelResolver.addBatch()');
return;
}
// ---- NOTE ---- delete example intent label if it is not in target.
subject.utteranceLabelsMap.forEach((labels: Set<string>, utterance: string) => {
Expand Down
17 changes: 17 additions & 0 deletions packages/orchestratorlib/test/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ describe('OrchestratorCreateTests', () => {
assert.ok(snapshotContent.indexOf('HomeAutomation') > 0);
assert.ok(snapshotContent.indexOf('Weather') > 0);

// add another lu file to input and make sure new intent is added (snapshot updated incrementally)
fs.ensureDirSync(inputPath2);
fs.copySync(path.resolve(inputPath), inputPath2);
fs.copySync(path.resolve('./test/fixtures/Gaming.lu'), path.join(inputPath2, 'Gaming.lu'));
Expand All @@ -91,6 +92,22 @@ describe('OrchestratorCreateTests', () => {
assert.ok(snapshotContent2.indexOf('HomeAutomation') > 0);
assert.ok(snapshotContent2.indexOf('Weather') > 0);
assert.ok(snapshotContent2.indexOf('Gaming') > 0);

// start clean and make sure file size is the same as previous run (snapshot created via addBatch)
Utility.deleteFile(snapshotPath);
await OrchestratorCreate.runAsync(
baseModelPath,
'',
inputPath2,
inputPath,
true);

assert.ok(Utility.exists(snapshotPath));
const snapshotContent3: string = OrchestratorHelper.readFile(snapshotPath);
assert.ok(snapshotContent3.length === snapshotContent2.length);
assert.ok(snapshotContent2.indexOf('HomeAutomation') > 0);
assert.ok(snapshotContent2.indexOf('Weather') > 0);
assert.ok(snapshotContent2.indexOf('Gaming') > 0);
});

it('Create Snapshot - LU file with reference to other LU file', async function (): Promise<void> {
Expand Down

0 comments on commit f16ca8f

Please sign in to comment.