Skip to content

Commit

Permalink
fix skill-id option for legacy skills (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamdenFoucht committed Aug 9, 2023
1 parent fbb3247 commit 3a71908
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 48 deletions.
12 changes: 0 additions & 12 deletions bin/askx-skill.ts

This file was deleted.

19 changes: 0 additions & 19 deletions bin/askx-smapi.ts

This file was deleted.

11 changes: 0 additions & 11 deletions bin/askx-util.ts

This file was deleted.

12 changes: 7 additions & 5 deletions lib/commands/option-model.json
Expand Up @@ -46,10 +46,12 @@
"description": "run skill in the specified simulation mode (currently supports DEFAULT / NFI_ISOLATED_SIMULATION)",
"alias": null,
"stringInput": "REQUIRED",
"rule": [{
"type": "ENUM",
"values": ["DEFAULT", "NFI_ISOLATED_SIMULATION"]
}]
"rule": [
{
"type": "ENUM",
"values": ["DEFAULT", "NFI_ISOLATED_SIMULATION"]
}
]
},
"skill-id": {
"name": "skill-id",
Expand All @@ -59,7 +61,7 @@
"rule": [
{
"type": "REGEX",
"regex": "^amzn\\d\\.ask\\.skill\\.\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
"regex": "^amzn\\d((\\.ask\\.skill)|(\\.echo-sdk-ams\\.app))\\.\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
}
]
},
Expand Down
7 changes: 6 additions & 1 deletion test/unit/commands/option-validator-test.js
Expand Up @@ -111,13 +111,14 @@ describe("Command test - Option validator test", () => {

const skillOptions = {
optionValid: "amzn1.ask.skill.1234abcd-12ab-abcd-1234-123456789012",
optionValidLegacy: "amzn1.echo-sdk-ams.app.1234abcd-12ab-abcd-1234-123456789012",
optionInvalid: "amzn1.ask.skill",
};

const skillRegex = [
{
type: "REGEX",
regex: "^amzn\\d\\.ask\\.skill\\.\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$",
regex: "^amzn\\d((\\.ask\\.skill)|(\\.echo-sdk-ams\\.app))\\.\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$",
},
];

Expand All @@ -130,6 +131,10 @@ describe("Command test - Option validator test", () => {
optionValidator.validateOptionRules(skillOptions, "optionValid", skillRegex);
}).not.throw();

expect(() => {
optionValidator.validateOptionRules(skillOptions, "optionValidLegacy", skillRegex);
}).not.throw();

// invalid regex expectations
expect(() => {
optionValidator.validateOptionRules(skillOptions, "optionInvalid", skillRegex);
Expand Down

0 comments on commit 3a71908

Please sign in to comment.