-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Rewrite suggestions and diagnostics in LG LSP with latest LG AP…
…Is (#2208) * init * fix importResolver * fix templates suggestions * fix return * fix get all templates method * fix comments * fix test cases * upgrade lgParser related api * fix * revert designIds * revert designIds * upgrade lg api change Co-authored-by: zhixzhan <zhixzhan@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
- Loading branch information
1 parent
528a468
commit 8d594d5
Showing
21 changed files
with
309 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { LGParser } from 'botbuilder-lg'; | ||
|
||
import { updateTemplate, addTemplate, removeTemplate } from '../src/utils/lgUtil'; | ||
|
||
describe('update lg template', () => { | ||
it('should update lg template', () => { | ||
const content = `# Exit | ||
-Thanks for using todo bot. | ||
# Greeting | ||
-What's up bro`; | ||
|
||
const template = { name: 'Exit', parameters: [], body: '-Bye' }; | ||
const newContent = updateTemplate(content, 'Exit', template); | ||
const { templates }: any = LGParser.parseText(newContent); | ||
expect(templates.length).toEqual(2); | ||
expect(templates[0].name).toEqual('Exit'); | ||
expect(templates[0].body).toEqual('-Bye'); | ||
}); | ||
}); | ||
|
||
describe('add lg template', () => { | ||
it('should add lg template', () => { | ||
const content = `# Exit | ||
-Thanks for using todo bot. | ||
# Greeting | ||
-What's up bro`; | ||
const template = { name: 'Hi', parameters: [], body: '-hello' }; | ||
const newContent = addTemplate(content, template); | ||
const { templates }: any = LGParser.parseText(newContent); | ||
expect(templates.length).toEqual(3); | ||
expect(templates[0].name).toEqual('Exit'); | ||
expect(templates[1].name).toEqual('Greeting'); | ||
expect(templates[2].name).toEqual('Hi'); | ||
}); | ||
}); | ||
|
||
describe('add lg template', () => { | ||
it('should add lg template', () => { | ||
const content = `# Exit | ||
-Thanks for using todo bot. | ||
# Greeting | ||
-What's up bro`; | ||
const newContent = removeTemplate(content, 'Greeting'); | ||
const { templates }: any = LGParser.parseText(newContent); | ||
expect(templates.length).toEqual(1); | ||
expect(templates[0].name).toEqual('Exit'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.