Skip to content

Commit

Permalink
Add userAgent casting (Azure#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpajdzik authored May 10, 2019
1 parent 3807aff commit 17d5bba
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/azureServiceClientTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2514,12 +2514,11 @@ describe("AzureServiceClient", () => {
describe("updateOptionsWithDefaultValues()", () => {
function assertOptionEqual(actual: AzureServiceClientOptions, expected: AzureServiceClientOptions) {
let actualUserAgent: string | undefined;
const userAgent: string | ((defaultUserAgent: string) => string) = actual.userAgent!;

if (typeof userAgent === "string") {
actualUserAgent = userAgent;
if (typeof actual.userAgent === "string") {
actualUserAgent = (actual.userAgent! as string);
} else if (typeof actual.userAgent === "function") {
actualUserAgent = userAgent("");
actualUserAgent = (actual.userAgent! as ((defaultUserAgent: string) => string))("");
}
delete actual.userAgent;
delete expected.userAgent;
Expand Down

0 comments on commit 17d5bba

Please sign in to comment.