forked from Azure/autorest.typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmediaTypesRest.spec.ts
46 lines (37 loc) · 1.31 KB
/
mediaTypesRest.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import MediaTypes, {
MediaTypesRestClient
} from "./generated/mediaTypesRest/src";
import { assert } from "chai";
describe("Media types Rest", () => {
let client: MediaTypesRestClient;
beforeEach(() => {
client = MediaTypes({ allowInsecureConnection: true });
});
// Issue https://github.com/Azure/autorest.typescript/issues/1242
it.skip("should handle /analyze with application/pdf", async () => {
const result = await client.path("/mediatypes/analyze").post({
contentType: "application/pdf",
body: "PDF"
});
assert.equal(result.status, "200");
assert.equal(result.body, "Nice job with PDF");
});
it("should handle /analyze with application/json", async () => {
const result = await client.path("/mediatypes/analyze").post({
contentType: "application/json",
body: { source: "TestPath" }
});
assert.equal(result.status, "200");
assert.equal(result.body, "Nice job with JSON");
});
it("should handle /contentTypeWithEncoding", async () => {
const result = await client
.path("/mediatypes/contentTypeWithEncoding")
.post({
contentType: "text/plain; encoding=UTF-8" as any,
body: "test"
});
assert.equal(result.status, "200");
assert.equal(result.body, "Nice job sending content type with encoding");
});
});