Skip to content

Commit

Permalink
Merge pull request VoxaAI#69 from rmberrios/staging
Browse files Browse the repository at this point in the history
 Fixed @sys. slots on dialogflow
  • Loading branch information
rmberrios committed May 16, 2019
2 parents 00f8047 + 090c0ae commit 0776647
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Now alexa spec is splitted into smaller units testing specific functionality
- Fixed @sys. slots on dialogflow were converted into a different type

## [2.1.2] - 2019-05-08

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voxa-cli",
"version": "2.1.2",
"version": "2.1.3-alpha1",
"description": "The Voxa CLI tools",
"bin": {
"voxa": "./bin/voxa.js"
Expand Down
5 changes: 4 additions & 1 deletion src/DialogflowSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ export class DialogflowSchema extends Schema {
const slot = _.find(parameters, { name: text });

if (isTemplate && slot) {
_.set(element, "meta", `@${_.kebabCase(slot.dataType)}`);
const slotMeta = slot.dataType.includes("@sys.")
? slot.dataType
: `@${_.kebabCase(slot.dataType)}`;
_.set(element, "meta", slotMeta);
_.set(element, "alias", alias);
}

Expand Down
20 changes: 20 additions & 0 deletions test/dialogflow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from "chai";
import * as _ from "lodash";
import * as path from "path";
import { configurations } from "./mocha.spec";

Expand Down Expand Up @@ -43,12 +44,18 @@ configurations.forEach(interactionFile => {

describe("NumberIntent", () => {
let intent: any;
let intentUtterance: any;
before(async () => {
intent = await require(path.join(
__dirname,
interactionFile.speechPath,
"dialogflow/production/intents/NumberIntent.json"
));
intentUtterance = await require(path.join(
__dirname,
interactionFile.speechPath,
"dialogflow/production/intents/NumberIntent_usersays_en.json"
));
});

it("should set slotRequired for the first slot to be false", () => {
Expand All @@ -59,6 +66,19 @@ configurations.forEach(interactionFile => {
it("should set webhookForSlotFilling to true", () => {
expect(intent.webhookForSlotFilling).to.be.true;
});

it("should have @sys slot for numbers", () => {
intentUtterance.forEach((utterance: any) => {
const numberMetaPhrase = utterance.data.find((item: any) => item.meta === "@sys.number");
expect(numberMetaPhrase).to.be.ok;

expect(_.pick(numberMetaPhrase, ["meta", "alias", "text"])).to.be.eql({
meta: "@sys.number",
alias: "number",
text: "{number}"
});
});
});
});

describe("JokeIntent", () => {
Expand Down

0 comments on commit 0776647

Please sign in to comment.