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

Commit f7da1b8

Browse files
authored
fix app name comparison logic in luis build (#1045)
1 parent 307bcd7 commit f7da1b8

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

packages/lu/src/parser/lubuild/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class Builder {
232232
// find if there is a matched name with current app under current authoring key
233233
if (!recognizer.getAppId()) {
234234
for (let app of apps) {
235-
if (app.name === currentApp.name) {
235+
if (app.name.toLowerCase() === currentApp.name.toLowerCase()) {
236236
recognizer.setAppId(app.id)
237237
break
238238
}

packages/luis/test/commands/luis/build.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,38 @@ describe('luis:build not update application if no changes', () => {
318318
})
319319
})
320320

321+
describe('luis:build not create application if kb name id only case different', () => {
322+
const existingLuisApp = require('./../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json')
323+
before(function () {
324+
nock('https://westus.api.cognitive.microsoft.com')
325+
.get(uri => uri.includes('apps'))
326+
.reply(200, [{
327+
name: 'test(development)-sandwich.en-us.lu',
328+
id: 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5'
329+
}])
330+
331+
nock('https://westus.api.cognitive.microsoft.com')
332+
.get(uri => uri.includes('apps'))
333+
.reply(200, {
334+
name: 'test(development)-sandwich.en-us.lu',
335+
id: 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5',
336+
activeVersion: '0.1'
337+
})
338+
339+
nock('https://westus.api.cognitive.microsoft.com')
340+
.get(uri => uri.includes('export'))
341+
.reply(200, existingLuisApp)
342+
})
343+
344+
test
345+
.stdout()
346+
.command(['luis:build', '--in', './test/fixtures/testcases/lubuild/sandwich/lufiles/sandwich.en-us.lu', '--authoringKey', uuidv1(), '--botName', 'TEST', '--log', '--suffix', 'development'])
347+
.it('should not create a luis application when an app with only case different name already existed in service', ctx => {
348+
expect(ctx.stdout).to.contain('Handling applications...')
349+
expect(ctx.stdout).to.contain('no changes')
350+
})
351+
})
352+
321353
describe('luis:build write dialog and settings assets successfully if --dialog set to multiLanguage', () => {
322354
const existingLuisApp = require('./../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json')
323355
before(async function () {

0 commit comments

Comments
 (0)