Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
[Skill Template][TypeScript] Refactor test structure, run build after…
Browse files Browse the repository at this point in the history
… installation (#1450)

* Run build after installation

* Refactor test structure

* Update sample
  • Loading branch information
Batta32 authored and darrenj committed May 29, 2019
1 parent 2c73696 commit 0f6d6d9
Show file tree
Hide file tree
Showing 49 changed files with 104 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ module.exports = class extends Generator {
)
);
} else {
this.spawnCommandSync('npm run build', []);
this.log(chalk.green(`------------------------ `));
this.log(chalk.green(` Your new skill is ready! `));
this.log(chalk.green(`------------------------ `));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class Copier {
path.join(`src`, `dialogs`, `skillDialogBase.ts`)
);
templateFiles.set(
path.join(`test`, `mockResources`, `_cognitiveModels.json`),
path.join(`test`, `mockResources`, `cognitiveModels.json`)
path.join(`test`, `mocks`, `resources`, `_cognitiveModels.json`),
path.join(`test`, `mocks`, `resources`, `cognitiveModels.json`)
);
selectedLanguages.forEach(language => {
templateFiles.set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
"nyc": "^14.1.1",
"replace": "^1.0.0",
"rimraf": "^2.6.2",
"source-map-support": "^0.5.12",
"ts-node": "^8.1.0",
"tslint": "^5.12.1",
"tslint-microsoft-contrib": "6.0.0",
"typescript": "^3.2.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let telemetryClient;
let userState;
let conversationState;
let cognitiveModelsRaw;
const TEST_MODE = require("../testBase").testMode;
const TEST_MODE = require("./testBase").testMode;

const getCognitiveModels = function(cognitiveModelsRaw) {
const cognitiveModelDictionary = cognitiveModelsRaw.cognitiveModels;
Expand All @@ -60,8 +60,8 @@ const setupEnvironment = function(testMode) {
getCognitiveModels(cognitiveModelsRaw);
break;
case "lockdown":
appsettings = require("../mockResources/appsettings.json");
cognitiveModelsRaw = require("../mockResources/cognitiveModels.json");
appsettings = require("../mocks/resources/appsettings.json");
cognitiveModelsRaw = require("../mocks/resources/cognitiveModels.json");
getCognitiveModels(cognitiveModelsRaw);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const join = require("path").join;

const nockBack = require("nock").back;
nockBack.setMode(TEST_MODE);
nockBack.fixtures = join(__dirname, "/nockFixtures");
nockBack.fixtures = join(__dirname, '..', 'mocks', 'nockFixtures');

const uuidRegex = /[a-f\d-]{8}-[a-f\d-]{4}-[a-f\d-]{4}-[a-f\d-]{4}-[a-f\d-]{12}/;
const qnaRegex = /\/\/[^.]+\.azurewebsites/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License.
*/

const skillTestBase = require("./skillTestBase");
const testNock = require("../testBase");
const skillTestBase = require("./helpers/skillTestBase");
const testNock = require("./helpers/testBase");

describe("interruption", function() {
beforeEach(async function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License.
*/

const skillTestBase = require("./skillTestBase");
const testNock = require("../testBase");
const skillTestBase = require("./helpers/skillTestBase");
const testNock = require("./helpers/testBase");

describe("localization", function() {
beforeEach(async function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License.
*/
const assert = require("assert");
const skillTestBase = require("./skillTestBase");
const testNock = require("../testBase");
const skillTestBase = require("./helpers/skillTestBase");
const testNock = require("./helpers/testBase");
const unhandledReplies = [
"Can you try to ask me again? I didn't get what you mean.",
"Can you say that in a different way?",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
--require ts-node/register
--require source-map-support/register
--reporter mocha-junit-reporter
--timeout 50000
--recursive
--colors
**/*Test.js
--colors

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"oauthConnections": [
{
"name": "",
"provider": ""
}
],
"properties": {},
"microsoftAppId": "<--MOCK-VALUE-->",
"microsoftAppPassword": "<--MOCK-VALUE-->",
"appInsights": {
"appId": "<--MOCK-VALUE-->",
"instrumentationKey": "<--MOCK-VALUE-->"
},
"blobStorage": {
"connectionString": "<--MOCK-VALUE-->",
"container": "transcripts"
},
"cosmosDb": {
"authkey": "<--MOCK-VALUE-->",
"collectionId": "botstate-collection",
"cosmosDBEndpoint": "https://skill-endpoint.documents.azure.com:443/",
"databaseId": "botstate-db"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

const assert = require("assert");
const skillTestBase = require("./skillTestBase");
const testNock = require("../testBase");
const skillTestBase = require("./helpers/skillTestBase");
const testNock = require("./helpers/testBase");
const nameInput = "custom";
const sampleDialogNameReplies = [
`Hi, ${nameInput}!`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
"nyc": "^14.1.1",
"replace": "^1.0.0",
"rimraf": "^2.6.2",
"source-map-support": "^0.5.12",
"ts-node": "^8.1.0",
"tslint": "^5.12.1",
"tslint-microsoft-contrib": "6.0.0",
"typescript": "^3.2.2"
Expand Down
Loading

0 comments on commit 0f6d6d9

Please sign in to comment.