Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ describe('lu operations', () => {
describe('qna operations', () => {
it('should get qna endpoint key', async () => {
await proj.init();
const subscriptionKey = '21640b8e2110449abfdfccf2f6bbee02';
proj.builder.qnaBuilder.getEndpointKeys = jest.fn(() => ({ primaryEndpointKey: 'new key' }));
const subscriptionKey = 'test';
const endpointKey = await proj.updateQnaEndpointKey(subscriptionKey);
expect(endpointKey).toBe('d423d198-b0cc-46b3-a48c-e32d7a7e5b8a');
expect(endpointKey).toBe('new key');
});
});
describe('buildFiles', () => {
Expand All @@ -272,11 +273,11 @@ describe('buildFiles', () => {
}
});

xit('should build lu & qna file successfully', async () => {
it('should build lu & qna file successfully', async () => {
proj.init();
const luisConfig = {
authoringEndpoint: '',
authoringKey: '412f0bfc19824ceca7a6076d05478850',
authoringKey: 'test',
authoringRegion: 'westus',
defaultLanguage: 'en-us',
endpoint: '',
Expand All @@ -287,7 +288,7 @@ describe('buildFiles', () => {
const qnaConfig = {
endpointKey: '',
qnaRegion: 'westus',
subscriptionKey: '21640b8e2110449abfdfccf2f6bbee02',
subscriptionKey: 'test',
};
const luResource: Resource[] = [
{ id: 'a.en-us', isEmpty: false },
Expand All @@ -299,16 +300,13 @@ describe('buildFiles', () => {
{ id: 'b.en-us', isEmpty: false },
{ id: 'bot1.en-us', isEmpty: false },
];
proj.builder.luBuilder.build = jest.fn((items) => items.map((item) => item.id));
proj.builder.luBuilder.writeDialogAssets = jest.fn();
proj.builder.qnaBuilder.build = jest.fn((items) => items.map((item) => item.id));
proj.builder.qnaBuilder.writeDialogAssets = jest.fn();
await proj.buildFiles({ luisConfig, qnaConfig, luResource, qnaResource });

try {
if (fs.existsSync(path)) {
const files = fs.readdirSync(path);
expect(files).toContain('a.lu.qna.dialog');
}
} catch (err) {
// ignore
}
expect(proj.builder.luBuilder.build).toHaveReturnedWith(['a', 'b', 'bot1']);
expect(proj.builder.qnaBuilder.build).toHaveReturnedWith(['a', 'b', 'bot1']);
});
});

Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/server/src/models/bot/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class Builder {
private _locale: string;
private containOrchestrator = false;

private luBuilder = new luBuild.Builder((message) => {
public luBuilder = new luBuild.Builder((message) => {
log(message);
});
private qnaBuilder = new qnaBuild.Builder((message) => {
public qnaBuilder = new qnaBuild.Builder((message) => {
log(message);
});

Expand Down