Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 55c5ab0

Browse files
authored
syncLabelResolverEx should return after addBatch (#1266) (#1267)
* Update build.ts Return after addBatch * Update create.test.ts
1 parent 8c430fd commit 55c5ab0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/orchestratorlib/src/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export class OrchestratorBuild {
161161
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), ready to call LabelResolver.addBatch()');
162162
LabelResolver.addBatch(target);
163163
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), after calling LabelResolver.addBatch()');
164+
return;
164165
}
165166
// ---- NOTE ---- delete example intent label if it is not in target.
166167
subject.utteranceLabelsMap.forEach((labels: Set<string>, utterance: string) => {

packages/orchestratorlib/test/create.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe('OrchestratorCreateTests', () => {
7474
assert.ok(snapshotContent.indexOf('HomeAutomation') > 0);
7575
assert.ok(snapshotContent.indexOf('Weather') > 0);
7676

77+
// add another lu file to input and make sure new intent is added (snapshot updated incrementally)
7778
fs.ensureDirSync(inputPath2);
7879
fs.copySync(path.resolve(inputPath), inputPath2);
7980
fs.copySync(path.resolve('./test/fixtures/Gaming.lu'), path.join(inputPath2, 'Gaming.lu'));
@@ -91,6 +92,22 @@ describe('OrchestratorCreateTests', () => {
9192
assert.ok(snapshotContent2.indexOf('HomeAutomation') > 0);
9293
assert.ok(snapshotContent2.indexOf('Weather') > 0);
9394
assert.ok(snapshotContent2.indexOf('Gaming') > 0);
95+
96+
// start clean and make sure file size is the same as previous run (snapshot created via addBatch)
97+
Utility.deleteFile(snapshotPath);
98+
await OrchestratorCreate.runAsync(
99+
baseModelPath,
100+
'',
101+
inputPath2,
102+
inputPath,
103+
true);
104+
105+
assert.ok(Utility.exists(snapshotPath));
106+
const snapshotContent3: string = OrchestratorHelper.readFile(snapshotPath);
107+
assert.ok(snapshotContent3.length === snapshotContent2.length);
108+
assert.ok(snapshotContent2.indexOf('HomeAutomation') > 0);
109+
assert.ok(snapshotContent2.indexOf('Weather') > 0);
110+
assert.ok(snapshotContent2.indexOf('Gaming') > 0);
94111
});
95112

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

0 commit comments

Comments
 (0)