Skip to content

Commit

Permalink
Merge 749a355 into eb601bd
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Laird-McConnell committed Sep 5, 2018
2 parents eb601bd + 749a355 commit b56f555
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libraries/botframework-config/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "botframework-config",
"author": "Microsoft Corp.",
"description": "library for working with Bot Framework .bot configuration files",
"version": "4.0.0-preview1.3.1",
"version": "4.0.0-preview1.3.2",
"license": "MIT",
"keywords": [
"bots",
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-config/src/botConfiguration.ts
Expand Up @@ -438,7 +438,7 @@ export class BotConfiguration extends BotConfigurationBase {
console.warn(`WARNING: Generic services cannot be cloned and all configuration data will be passed unchanged and unencrypted `);
let genericService = <IGenericService>service;
let genericResource: IGenericResource = {
type: ServiceTypes.File,
type: ServiceTypes.Generic,
id: service.id,
name: service.name,
url: genericService.url,
Expand Down
25 changes: 20 additions & 5 deletions libraries/botframework-config/tests/export.test.js
Expand Up @@ -12,23 +12,25 @@ const saveBotPath = testBotPath.replace("test.bot", "save.bot");
describe("ExportTests", () => {
it("ExportBot", async () => {
var config = await bf.BotConfiguration.load(testBotPath);
let messages = [];
let services = [];
let exportFolder = path.join(path.dirname(__filename),'exportfolder');

await config.export(exportFolder, {
download: false, // disable download
progress: (service, command, index, total) => messages.push(service.name)
progress: (service, command, index, total) => services.push(service)
});

for (let service of config.services) {
let found = false;
for (let message of messages) {
if (message === service.name) {
for (let svc of services) {
if ((service.id === svc.id) &&
(service.type === svc.type) &&
(service.name === svc.name)) {
found = true;
break;
}
}
assert.ok(found, `${service.name} not sent as status`);
assert.ok(found, `${service.name} not published through progress`);
}

let recipePath = path.join(exportFolder, 'bot.recipe');
Expand All @@ -39,6 +41,19 @@ describe("ExportTests", () => {

let recipe = bf.BotRecipe.fromJSON(JSON.parse(json));
assert.equal(config.services.length, recipe.resources.length, "service count not equal");
for (let service of config.services) {
let found = false;
for (let resource of recipe.resources) {
if ((service.id === resource.id) &&
(service.type === resource.type) &&
(service.name === resource.name)) {
found = true;
break;
}
}
assert.ok(found, `${service.name} not exported correctly `);
}


let json2 = recipe.toJSON();
assert.deepEqual(json2, JSON.parse(json), "serialization diffeent");
Expand Down

0 comments on commit b56f555

Please sign in to comment.