Skip to content

Commit

Permalink
[communication] Fix SDK_VERSION value (Azure#12546)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikMe committed Nov 14, 2020
1 parent f3780cf commit 1bfc363
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { apiVersion } from "./generated/src/models/parameters";

export const SDK_VERSION: string = apiVersion.mapper.defaultValue;
export const SDK_VERSION: string = "1.0.0-beta.3";
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { apiVersion } from "./generated/src/models/parameters";

export const SDK_VERSION: string = apiVersion.mapper.defaultValue;
export const SDK_VERSION: string = "1.0.0-beta.3";
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ import {
PhoneNumberAdministrationClient,
PhoneNumberCapabilitiesUpdates
} from "../src";
import { SDK_VERSION } from "../src/phoneNumber/constants";
import { NumberConfigurationPhoneNumber } from "../src/phoneNumber/generated/src/models";
import { apiVersion } from "../src/phoneNumber/generated/src/models/parameters";
import {
baseHttpClient,
getAreaCodesHttpClient,
phoneNumbersCapabilitiesHttpClient
} from "./utils/mockHttpClients";
import { TestPhoneNumberAdministrationClient } from "./utils/testPhoneNumberAdministrationClient";

const API_VERSION = apiVersion.mapper.defaultValue;

describe("PhoneNumberAdministrationClient [Mocked]", () => {
const dateHeader = isNode ? "date" : "x-ms-date";

Expand Down Expand Up @@ -118,7 +120,7 @@ describe("PhoneNumberAdministrationClient [Mocked]", () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`https://contoso.spool.azure.local/administration/phonenumbers/capabilities/${capabilitiesUpdateId}?api-version=${SDK_VERSION}`
`https://contoso.spool.azure.local/administration/phonenumbers/capabilities/${capabilitiesUpdateId}?api-version=${API_VERSION}`
);
});

Expand All @@ -145,7 +147,7 @@ describe("PhoneNumberAdministrationClient [Mocked]", () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`https://contoso.spool.azure.local/administration/phonenumbers/countries/${searchRequest.countryCode}/areacodes?locationType=${searchRequest.locationType}&phonePlanId=${searchRequest.phonePlanId}&api-version=${SDK_VERSION}`
`https://contoso.spool.azure.local/administration/phonenumbers/countries/${searchRequest.countryCode}/areacodes?locationType=${searchRequest.locationType}&phonePlanId=${searchRequest.phonePlanId}&api-version=${API_VERSION}`
);
});
});
4 changes: 1 addition & 3 deletions sdk/communication/communication-chat/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { apiVersion } from "./generated/src/models/parameters";

export const SDK_VERSION: string = apiVersion.mapper.defaultValue;
export const SDK_VERSION: string = "1.0.0-beta.3";
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sinon from "sinon";
import { assert } from "chai";
import { ChatClient, CreateChatThreadRequest } from "../src";
import * as RestModel from "../src/generated/src/models";
import { SDK_VERSION } from "../src/constants";
import { apiVersion } from "../src/generated/src/models/parameters";
import { baseUri, generateToken } from "./utils/connectionUtils";
import { AzureCommunicationUserCredential } from "@azure/communication-common";
import {
Expand All @@ -15,6 +15,8 @@ import {
mockThreadInfo
} from "./utils/mockClient";

const API_VERSION = apiVersion.mapper.defaultValue;

describe("[Mocked] ChatClient", async () => {
let chatClient: ChatClient;

Expand Down Expand Up @@ -54,7 +56,7 @@ describe("[Mocked] ChatClient", async () => {

const request = spy.getCall(0).args[0];

assert.equal(request.url, `${baseUri}/chat/threads?api-version=${SDK_VERSION}`);
assert.equal(request.url, `${baseUri}/chat/threads?api-version=${API_VERSION}`);
assert.equal(request.method, "POST");
assert.deepEqual(JSON.parse(request.body), sendRequest);
});
Expand Down Expand Up @@ -86,7 +88,7 @@ describe("[Mocked] ChatClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${mockThread.id}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${mockThread.id}?api-version=${API_VERSION}`
);
assert.equal(request.method, "GET");
});
Expand All @@ -111,7 +113,7 @@ describe("[Mocked] ChatClient", async () => {
assert.equal(count, mockResponse.value?.length);
const request = spy.getCall(0).args[0];

assert.equal(request.url, `${baseUri}/chat/threads?api-version=${SDK_VERSION}`);
assert.equal(request.url, `${baseUri}/chat/threads?api-version=${API_VERSION}`);
assert.equal(request.method, "GET");
});

Expand All @@ -126,7 +128,7 @@ describe("[Mocked] ChatClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${mockThread.id}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${mockThread.id}?api-version=${API_VERSION}`
);
assert.equal(request.method, "DELETE");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
AddMembersRequest
} from "../src";
import * as RestModel from "../src/generated/src/models";
import { SDK_VERSION } from "../src/constants";
import { apiVersion } from "../src/generated/src/models/parameters";
import { baseUri, generateToken } from "./utils/connectionUtils";
import {
generateHttpClient,
Expand All @@ -24,6 +24,8 @@ import {
mockReadReceipt
} from "./utils/mockClient";

const API_VERSION = apiVersion.mapper.defaultValue;

describe("[Mocked] ChatThreadClient", async () => {
const threadId: string = "threadId";
let chatThreadClient: ChatThreadClient;
Expand All @@ -50,7 +52,7 @@ describe("[Mocked] ChatThreadClient", async () => {

sinon.assert.calledOnce(spy);
const request = spy.getCall(0).args[0];
assert.equal(request.url, `${baseUri}/chat/threads/${threadId}?api-version=${SDK_VERSION}`);
assert.equal(request.url, `${baseUri}/chat/threads/${threadId}?api-version=${API_VERSION}`);
assert.equal(request.method, "PATCH");
assert.deepEqual(JSON.parse(request.body), { topic: sendOptions.topic });
});
Expand Down Expand Up @@ -79,7 +81,7 @@ describe("[Mocked] ChatThreadClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/messages?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/messages?api-version=${API_VERSION}`
);
assert.equal(request.method, "POST");
assert.deepEqual(JSON.parse(request.body), {
Expand Down Expand Up @@ -108,7 +110,7 @@ describe("[Mocked] ChatThreadClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${API_VERSION}`
);
assert.equal(request.method, "GET");
});
Expand Down Expand Up @@ -140,7 +142,7 @@ describe("[Mocked] ChatThreadClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/messages?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/messages?api-version=${API_VERSION}`
);
assert.equal(request.method, "GET");
});
Expand All @@ -160,7 +162,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${API_VERSION}`
);
assert.equal(request.method, "PATCH");
assert.deepEqual(JSON.parse(request.body), { content: mockMessage.content });
Expand All @@ -177,7 +179,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/messages/${mockMessage.id}?api-version=${API_VERSION}`
);
assert.equal(request.method, "DELETE");
});
Expand All @@ -198,7 +200,7 @@ describe("[Mocked] ChatThreadClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/members?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/members?api-version=${API_VERSION}`
);
assert.equal(request.method, "POST");
const requestJson = JSON.parse(request.body);
Expand Down Expand Up @@ -234,7 +236,7 @@ describe("[Mocked] ChatThreadClient", async () => {

assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/members?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/members?api-version=${API_VERSION}`
);
assert.equal(request.method, "GET");
});
Expand All @@ -250,7 +252,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/members/${mockSdkModelMember.user.communicationUserId}?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/members/${mockSdkModelMember.user.communicationUserId}?api-version=${API_VERSION}`
);
assert.equal(request.method, "DELETE");
});
Expand All @@ -267,7 +269,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/typing?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/typing?api-version=${API_VERSION}`
);
assert.equal(request.method, "POST");
});
Expand All @@ -283,7 +285,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/readreceipts?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/readreceipts?api-version=${API_VERSION}`
);
assert.equal(request.method, "POST");
});
Expand All @@ -309,7 +311,7 @@ describe("[Mocked] ChatThreadClient", async () => {
const request = spy.getCall(0).args[0];
assert.equal(
request.url,
`${baseUri}/chat/threads/${threadId}/readreceipts?api-version=${SDK_VERSION}`
`${baseUri}/chat/threads/${threadId}/readreceipts?api-version=${API_VERSION}`
);
assert.equal(request.method, "GET");
});
Expand Down
4 changes: 1 addition & 3 deletions sdk/communication/communication-sms/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { apiVersion } from "./generated/src/models/parameters";

export const SDK_VERSION: string = apiVersion.mapper.defaultValue;
export const SDK_VERSION: string = "1.0.0-beta.3";
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { AzureKeyCredential } from "@azure/core-auth";
import { assert } from "chai";
import sinon from "sinon";
import { SmsClient, SendRequest } from "../src/smsClient";
import { SDK_VERSION } from "../src/constants";
import { apiVersion } from "../src/generated/src/models/parameters";

const API_VERSION = apiVersion.mapper.defaultValue;

describe("[mocked] SmsClient", async () => {
const baseUri = "https://contoso.api.fake:443";
Expand Down Expand Up @@ -57,7 +59,7 @@ describe("[mocked] SmsClient", async () => {

const request = spy.getCall(0).args[0];

assert.equal(request.url, `${baseUri}/sms?api-version=${SDK_VERSION}`);
assert.equal(request.url, `${baseUri}/sms?api-version=${API_VERSION}`);
assert.equal(request.method, "POST");
assert.deepEqual(JSON.parse(request.body), { ...sendRequest, sendSmsOptions: {} });
});
Expand All @@ -79,7 +81,7 @@ describe("[mocked] SmsClient", async () => {

const request = spy.getCall(0).args[0];

assert.equal(request.url, `${baseUri}/sms?api-version=${SDK_VERSION}`);
assert.equal(request.url, `${baseUri}/sms?api-version=${API_VERSION}`);
assert.equal(request.method, "POST");
assert.deepEqual(JSON.parse(request.body), { ...sendRequest, sendSmsOptions: {} });
});
Expand Down

0 comments on commit 1bfc363

Please sign in to comment.