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

Make luis application name comparison case insensitve in luis build #1045

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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