From d6c15703ee9c8dbedba0e14c60f9bea2d6de2fe3 Mon Sep 17 00:00:00 2001 From: armansabaa Date: Wed, 21 Apr 2021 14:53:25 -0700 Subject: [PATCH] [Communication][Chat] Changes required for min-max testing (#14942) * Moving tests under public folder * enabling minmax jobs * disabling minmax test for now * moving files referencing generated under /internal * nit fix command --- .../communication-chat/.vscode/launch.json | 2 +- sdk/communication/communication-chat/package.json | 2 +- .../communication-chat/rollup.base.config.js | 14 ++++++++++++-- .../test/{ => internal}/chatClient.mocked.spec.ts | 8 ++++---- .../{ => internal}/chatThreadClient.mocked.spec.ts | 8 ++++---- .../test/{ => internal}/utils/mockClient.ts | 8 ++++---- .../test/{ => public}/chatClient.spec.ts | 2 +- .../test/{ => public}/chatThreadClient.spec.ts | 2 +- .../test/{ => public}/utils/connectionUtils.ts | 0 .../test/{ => public}/utils/recordedClient.ts | 2 +- 10 files changed, 29 insertions(+), 19 deletions(-) rename sdk/communication/communication-chat/test/{ => internal}/chatClient.mocked.spec.ts (92%) rename sdk/communication/communication-chat/test/{ => internal}/chatThreadClient.mocked.spec.ts (98%) rename sdk/communication/communication-chat/test/{ => internal}/utils/mockClient.ts (92%) rename sdk/communication/communication-chat/test/{ => public}/chatClient.spec.ts (99%) rename sdk/communication/communication-chat/test/{ => public}/chatThreadClient.spec.ts (98%) rename sdk/communication/communication-chat/test/{ => public}/utils/connectionUtils.ts (100%) rename sdk/communication/communication-chat/test/{ => public}/utils/recordedClient.ts (98%) diff --git a/sdk/communication/communication-chat/.vscode/launch.json b/sdk/communication/communication-chat/.vscode/launch.json index 6978049bdb4e..3072c52c488e 100644 --- a/sdk/communication/communication-chat/.vscode/launch.json +++ b/sdk/communication/communication-chat/.vscode/launch.json @@ -15,7 +15,7 @@ "--timeout", "999999", "--colors", - "${workspaceFolder}/test/*.spec.ts" + "${workspaceFolder}/test/**/*.spec.ts" ], "env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}", diff --git a/sdk/communication/communication-chat/package.json b/sdk/communication/communication-chat/package.json index 2e12a4ec2cd8..2f842f762dfc 100644 --- a/sdk/communication/communication-chat/package.json +++ b/sdk/communication/communication-chat/package.json @@ -22,7 +22,7 @@ "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "karma start --single-run", - "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace -t 300000 \"dist-esm/test/*.spec.js\" \"dist-esm/test/node/*.spec.js\"", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace -t 300000 dist-esm/test/public/*.spec.js dist-esm/test/public/node/*.spec.js", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts", diff --git a/sdk/communication/communication-chat/rollup.base.config.js b/sdk/communication/communication-chat/rollup.base.config.js index fb3cfa2d4624..ba527d8df5e2 100644 --- a/sdk/communication/communication-chat/rollup.base.config.js +++ b/sdk/communication/communication-chat/rollup.base.config.js @@ -41,7 +41,12 @@ export function nodeConfig(test = false) { if (test) { // Entry points - test files under the `test` folder(common for both browser and node), node specific test files - baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"]; + baseConfig.input = [ + "dist-esm/test/public/*.spec.js", + "dist-esm/test/internal/*.spec.js", + "dist-esm/test/public/node/*.spec.js", + "dist-esm/test/internal/node/*.spec.js" + ]; baseConfig.plugins.unshift(multiEntry({ exports: false })); // different output file @@ -110,7 +115,12 @@ export function browserConfig(test = false) { if (test) { // Entry points - test files under the `test` folder(common for both browser and node), browser specific test files - baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/browser/*.spec.js"]; + baseConfig.input = [ + "dist-esm/test/public/*.spec.js", + "dist-esm/test/internal/*.spec.js", + "dist-esm/test/public/browser/*.spec.js", + "dist-esm/test/internal/browser/*.spec.js" + ]; baseConfig.plugins.unshift(multiEntry({ exports: false })); baseConfig.output.file = "dist-test/index.browser.js"; diff --git a/sdk/communication/communication-chat/test/chatClient.mocked.spec.ts b/sdk/communication/communication-chat/test/internal/chatClient.mocked.spec.ts similarity index 92% rename from sdk/communication/communication-chat/test/chatClient.mocked.spec.ts rename to sdk/communication/communication-chat/test/internal/chatClient.mocked.spec.ts index d7e8802d5d4b..939880cb0603 100644 --- a/sdk/communication/communication-chat/test/chatClient.mocked.spec.ts +++ b/sdk/communication/communication-chat/test/internal/chatClient.mocked.spec.ts @@ -3,10 +3,10 @@ import sinon from "sinon"; import { assert } from "chai"; -import { ChatClient, CreateChatThreadRequest } from "../src"; -import * as RestModel from "../src/generated/src/models"; -import { apiVersion } from "../src/generated/src/models/parameters"; -import { baseUri, generateToken } from "./utils/connectionUtils"; +import { ChatClient, CreateChatThreadRequest } from "../../src"; +import * as RestModel from "../../src/generated/src/models"; +import { apiVersion } from "../../src/generated/src/models/parameters"; +import { baseUri, generateToken } from "../public/utils/connectionUtils"; import { AzureCommunicationTokenCredential, CommunicationUserIdentifier diff --git a/sdk/communication/communication-chat/test/chatThreadClient.mocked.spec.ts b/sdk/communication/communication-chat/test/internal/chatThreadClient.mocked.spec.ts similarity index 98% rename from sdk/communication/communication-chat/test/chatThreadClient.mocked.spec.ts rename to sdk/communication/communication-chat/test/internal/chatThreadClient.mocked.spec.ts index 159c57c2811b..b34333dbba6e 100644 --- a/sdk/communication/communication-chat/test/chatThreadClient.mocked.spec.ts +++ b/sdk/communication/communication-chat/test/internal/chatThreadClient.mocked.spec.ts @@ -13,10 +13,10 @@ import { SendMessageOptions, UpdateMessageOptions, AddParticipantsRequest -} from "../src"; -import * as RestModel from "../src/generated/src/models"; -import { apiVersion } from "../src/generated/src/models/parameters"; -import { baseUri, generateToken } from "./utils/connectionUtils"; +} from "../../src"; +import * as RestModel from "../../src/generated/src/models"; +import { apiVersion } from "../../src/generated/src/models/parameters"; +import { baseUri, generateToken } from "../public/utils/connectionUtils"; import { generateHttpClient, createChatThreadClient, diff --git a/sdk/communication/communication-chat/test/utils/mockClient.ts b/sdk/communication/communication-chat/test/internal/utils/mockClient.ts similarity index 92% rename from sdk/communication/communication-chat/test/utils/mockClient.ts rename to sdk/communication/communication-chat/test/internal/utils/mockClient.ts index c026415a3054..8e553e709d7c 100644 --- a/sdk/communication/communication-chat/test/utils/mockClient.ts +++ b/sdk/communication/communication-chat/test/internal/utils/mockClient.ts @@ -3,10 +3,10 @@ import { AzureCommunicationTokenCredential } from "@azure/communication-common"; import { HttpClient, HttpHeaders, WebResourceLike, HttpOperationResponse } from "@azure/core-http"; -import * as RestModel from "../../src/generated/src/models"; -import { ChatClient, ChatParticipant, ChatThreadClient } from "../../src"; -import { CommunicationIdentifierModel } from "../../src/generated/src"; -import { baseUri, generateToken } from "./connectionUtils"; +import * as RestModel from "../../../src/generated/src/models"; +import { ChatClient, ChatParticipant, ChatThreadClient } from "../../../src"; +import { CommunicationIdentifierModel } from "../../../src/generated/src"; +import { baseUri, generateToken } from "../../public/utils/connectionUtils"; export const mockCommunicationIdentifier: CommunicationIdentifierModel = { communicationUser: { id: "id" } diff --git a/sdk/communication/communication-chat/test/chatClient.spec.ts b/sdk/communication/communication-chat/test/public/chatClient.spec.ts similarity index 99% rename from sdk/communication/communication-chat/test/chatClient.spec.ts rename to sdk/communication/communication-chat/test/public/chatClient.spec.ts index 4eea55a95076..45c4b9957665 100644 --- a/sdk/communication/communication-chat/test/chatClient.spec.ts +++ b/sdk/communication/communication-chat/test/public/chatClient.spec.ts @@ -3,7 +3,7 @@ import { isLiveMode, Recorder } from "@azure/test-utils-recorder"; import { assert } from "chai"; -import { ChatClient, ChatThreadClient } from "../src"; +import { ChatClient, ChatThreadClient } from "../../src"; import { createTestUser, createRecorder, createChatClient } from "./utils/recordedClient"; import { isNode } from "@azure/core-http"; import sinon from "sinon"; diff --git a/sdk/communication/communication-chat/test/chatThreadClient.spec.ts b/sdk/communication/communication-chat/test/public/chatThreadClient.spec.ts similarity index 98% rename from sdk/communication/communication-chat/test/chatThreadClient.spec.ts rename to sdk/communication/communication-chat/test/public/chatThreadClient.spec.ts index e395005f257d..ce0bc0f2a86e 100644 --- a/sdk/communication/communication-chat/test/chatThreadClient.spec.ts +++ b/sdk/communication/communication-chat/test/public/chatThreadClient.spec.ts @@ -3,7 +3,7 @@ import { Recorder } from "@azure/test-utils-recorder"; import { assert } from "chai"; -import { ChatClient, ChatThreadClient } from "../src"; +import { ChatClient, ChatThreadClient } from "../../src"; import { createTestUser, createRecorder, createChatClient } from "./utils/recordedClient"; import { CommunicationIdentifier, getIdentifierKind } from "@azure/communication-common"; import { Context } from "mocha"; diff --git a/sdk/communication/communication-chat/test/utils/connectionUtils.ts b/sdk/communication/communication-chat/test/public/utils/connectionUtils.ts similarity index 100% rename from sdk/communication/communication-chat/test/utils/connectionUtils.ts rename to sdk/communication/communication-chat/test/public/utils/connectionUtils.ts diff --git a/sdk/communication/communication-chat/test/utils/recordedClient.ts b/sdk/communication/communication-chat/test/public/utils/recordedClient.ts similarity index 98% rename from sdk/communication/communication-chat/test/utils/recordedClient.ts rename to sdk/communication/communication-chat/test/public/utils/recordedClient.ts index a2a2f5f322d9..590ac6fce1f1 100644 --- a/sdk/communication/communication-chat/test/utils/recordedClient.ts +++ b/sdk/communication/communication-chat/test/public/utils/recordedClient.ts @@ -12,7 +12,7 @@ import { isNode, WebResourceLike } from "@azure/core-http"; -import { ChatClient } from "../../src"; +import { ChatClient } from "../../../src"; import { CommunicationUserIdentifier, AzureCommunicationTokenCredential,