Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed Jun 21, 2018
1 parent fa2f159 commit d47e2a1
Showing 1 changed file with 40 additions and 36 deletions.
76 changes: 40 additions & 36 deletions test/shared/serviceClientTests.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ServiceClient, WebResource, Serializer, HttpOperationResponse, DictionaryMapper } from "../../lib/msRest";
import * as assert from "assert";

describe("ServiceClient", function() {
it("should serialize headerCollectionPrefix", async function() {
describe("ServiceClient", function () {
it("should serialize headerCollectionPrefix", async function () {
const expected = {
"foo-bar-alpha": "hello",
"foo-bar-beta": "world",
Expand All @@ -21,45 +21,49 @@ describe("ServiceClient", function() {
requestPolicyCreators: []
});

await client.sendOperationRequest(new WebResource(), {
arguments: {
metadata: {
"alpha": "hello",
"beta": "world"
},
unrelated: 42
}
}, {
httpMethod: "GET",
baseUrl: "httpbin.org",
serializer: new Serializer(),
headerParameters: [{
parameterPath: "metadata",
mapper: {
serializedName: "metadata",
type: {
name: "Dictionary",
value: {
type: {
name: "String"
await client.sendOperationRequest(
new WebResource(), {
arguments: {
metadata: {
"alpha": "hello",
"beta": "world"
},
unrelated: 42
}
},
{
httpMethod: "GET",
baseUrl: "httpbin.org",
serializer: new Serializer(),
headerParameters: [{
parameterPath: "metadata",
mapper: {
serializedName: "metadata",
type: {
name: "Dictionary",
value: {
type: {
name: "String"
}
}
},
headerCollectionPrefix: "foo-bar-"
} as DictionaryMapper
}, {
parameterPath: "unrelated",
mapper: {
serializedName: "unrelated",
type: {
name: "Number"
}
},
headerCollectionPrefix: "foo-bar-"
} as DictionaryMapper
}, {
parameterPath: "unrelated",
mapper: {
serializedName: "unrelated",
type: {
name: "Number"
}
}],
responses: {
200: {}
}
}]
});

});

assert(request!);
assert.deepStrictEqual(request!.headers.toJson(), expected);
});
})
});

0 comments on commit d47e2a1

Please sign in to comment.