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

Commit

Permalink
fix app name comparison logic in luis build (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
feich-ms authored Nov 5, 2020
1 parent 307bcd7 commit f7da1b8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/lu/src/parser/lubuild/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class Builder {
// find if there is a matched name with current app under current authoring key
if (!recognizer.getAppId()) {
for (let app of apps) {
if (app.name === currentApp.name) {
if (app.name.toLowerCase() === currentApp.name.toLowerCase()) {
recognizer.setAppId(app.id)
break
}
Expand Down
32 changes: 32 additions & 0 deletions packages/luis/test/commands/luis/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,38 @@ describe('luis:build not update application if no changes', () => {
})
})

describe('luis:build not create application if kb name id only case different', () => {
const existingLuisApp = require('./../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json')
before(function () {
nock('https://westus.api.cognitive.microsoft.com')
.get(uri => uri.includes('apps'))
.reply(200, [{
name: 'test(development)-sandwich.en-us.lu',
id: 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5'
}])

nock('https://westus.api.cognitive.microsoft.com')
.get(uri => uri.includes('apps'))
.reply(200, {
name: 'test(development)-sandwich.en-us.lu',
id: 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5',
activeVersion: '0.1'
})

nock('https://westus.api.cognitive.microsoft.com')
.get(uri => uri.includes('export'))
.reply(200, existingLuisApp)
})

test
.stdout()
.command(['luis:build', '--in', './test/fixtures/testcases/lubuild/sandwich/lufiles/sandwich.en-us.lu', '--authoringKey', uuidv1(), '--botName', 'TEST', '--log', '--suffix', 'development'])
.it('should not create a luis application when an app with only case different name already existed in service', ctx => {
expect(ctx.stdout).to.contain('Handling applications...')
expect(ctx.stdout).to.contain('no changes')
})
})

describe('luis:build write dialog and settings assets successfully if --dialog set to multiLanguage', () => {
const existingLuisApp = require('./../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json')
before(async function () {
Expand Down

0 comments on commit f7da1b8

Please sign in to comment.