Skip to content

Commit 1f43517

Browse files
committed
Updated to 18.9
1 parent df9e925 commit 1f43517

27 files changed

+826
-752
lines changed

test/testAnnotations.ts

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,72 @@
2121

2222
import * as BaseTest from "./baseTestPdfApi";
2323
import "mocha";
24-
import { HttpStatusCode } from "../src/models/httpStatusCode";
2524
var assert = require('assert');
2625

2726
describe("Annotations Tests", () => {
2827

2928
const name = "PdfWithAnnotations.pdf";
3029
const pageNumber = 2;
3130

32-
describe("Get Page Annotations Test", () => {
31+
32+
beforeEach( async ()=> {
33+
await BaseTest.uploadFile(name);
34+
});
35+
36+
describe("Get Document Annotations Test", () => {
3337

3438
it("should return response with code 200", async () => {
39+
40+
return BaseTest.getPdfApi().getDocumentAnnotations(name, null, BaseTest.remoteTempFolder)
41+
.then((result) => {
42+
assert.equal(result.response.statusCode, 200);
43+
});
44+
});
45+
});
46+
47+
describe("Delete Document Annotations Test", () => {
48+
49+
it("should return response with code 200", async () => {
50+
51+
return BaseTest.getPdfApi().deleteDocumentAnnotations(name, null, BaseTest.remoteTempFolder)
52+
.then((result) => {
53+
assert.equal(result.response.statusCode, 200);
54+
});
55+
});
56+
});
57+
58+
describe("Get Page Annotations Test", () => {
3559

36-
await BaseTest.uploadFile(name);
60+
it("should return response with code 200", async () => {
3761

3862
return BaseTest.getPdfApi().getPageAnnotations(name, pageNumber, null, BaseTest.remoteTempFolder)
3963
.then((result) => {
40-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
64+
assert.equal(result.response.statusCode, 200);
4165
});
4266
});
4367
});
4468

45-
describe("Get Page Annotation Test", () => {
69+
describe("Delete Page Annotations Test", () => {
4670

4771
it("should return response with code 200", async () => {
48-
49-
const annotationNumber = 2;
50-
await BaseTest.uploadFile(name);
5172

52-
return BaseTest.getPdfApi().getPageAnnotation(name, pageNumber, annotationNumber, null, BaseTest.remoteTempFolder)
73+
return BaseTest.getPdfApi().deletePageAnnotations(name, pageNumber, null, BaseTest.remoteTempFolder)
74+
.then((result) => {
75+
assert.equal(result.response.statusCode, 200);
76+
});
77+
});
78+
});
79+
80+
describe("Delete Annotation Test", () => {
81+
82+
it("should return response with code 200", async () => {
83+
84+
const result = await BaseTest.getPdfApi().getDocumentAnnotations(name, null, BaseTest.remoteTempFolder)
85+
const annotationId = result.body.annotations.list[0].id;
86+
87+
return BaseTest.getPdfApi().deleteAnnotation(name, annotationId, null, BaseTest.remoteTempFolder)
5388
.then((result) => {
54-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
89+
assert.equal(result.response.statusCode, 200);
5590
});
5691
});
5792
});

test/testAppend.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import * as BaseTest from "./baseTestPdfApi";
2323
import "mocha";
24-
import { HttpStatusCode } from "../src/models/httpStatusCode";
2524
import { AppendDocument } from "../src/models/appendDocument";
2625
var assert = require('assert');
2726

@@ -33,16 +32,18 @@ describe("Append Tests", () => {
3332
const startPage = 2;
3433
const endPage = 4;
3534

35+
beforeEach( async ()=> {
36+
await BaseTest.uploadFile(name);
37+
await BaseTest.uploadFile(appendFile);
38+
});
39+
3640
describe("PostAppendDocument using query parameters Test", () => {
3741

3842
it("should return response with code 200", async () => {
3943

40-
await BaseTest.uploadFile(name);
41-
await BaseTest.uploadFile(appendFile);
42-
4344
return BaseTest.getPdfApi().postAppendDocument(name, null, appendFilePath, startPage, endPage, null, BaseTest.remoteTempFolder)
4445
.then((result) => {
45-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
46+
assert.equal(result.response.statusCode, 200);
4647
});
4748
});
4849
});
@@ -51,18 +52,14 @@ describe("Append Tests", () => {
5152

5253
it("should return response with code 200", async () => {
5354

54-
await BaseTest.uploadFile(name);
55-
await BaseTest.uploadFile(appendFile);
56-
5755
let appendDocument = new AppendDocument();
5856
appendDocument.document = appendFilePath;
5957
appendDocument.startPage = startPage;
6058
appendDocument.endPage = endPage;
6159

62-
6360
return BaseTest.getPdfApi().postAppendDocument(name, null, appendFilePath, startPage, endPage, null, BaseTest.remoteTempFolder)
6461
.then((result) => {
65-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
62+
assert.equal(result.response.statusCode, 200);
6663
});
6764
});
6865
});

test/testAttachments.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import * as BaseTest from "./baseTestPdfApi";
2323
import "mocha";
24-
import { HttpStatusCode } from "../src/models/httpStatusCode";
2524
var assert = require('assert');
2625

2726
describe("Attachments Tests", () => {
@@ -39,7 +38,7 @@ describe("Attachments Tests", () => {
3938

4039
return BaseTest.getPdfApi().getDocumentAttachmentByIndex(name, attachmentIndex, null, BaseTest.remoteTempFolder)
4140
.then((result) => {
42-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
41+
assert.equal(result.response.statusCode, 200);
4342
});
4443
});
4544
});
@@ -50,7 +49,7 @@ describe("Attachments Tests", () => {
5049

5150
return BaseTest.getPdfApi().getDocumentAttachments(name, null, BaseTest.remoteTempFolder)
5251
.then((result) => {
53-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
52+
assert.equal(result.response.statusCode, 200);
5453
});
5554
});
5655
});
@@ -61,7 +60,7 @@ describe("Attachments Tests", () => {
6160

6261
return BaseTest.getPdfApi().getDownloadDocumentAttachmentByIndex(name, attachmentIndex, null, BaseTest.remoteTempFolder)
6362
.then((result) => {
64-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
63+
assert.equal(result.response.statusCode, 200);
6564
});
6665
});
6766
});

test/testBookmarks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import * as BaseTest from "./baseTestPdfApi";
2323
import "mocha";
24-
import { HttpStatusCode } from "../src/models/httpStatusCode";
2524
var assert = require('assert');
2625

2726
describe("Bookmarks Tests", () => {
@@ -38,7 +37,7 @@ describe("Bookmarks Tests", () => {
3837

3938
return BaseTest.getPdfApi().getDocumentBookmarks(name, null, null, BaseTest.remoteTempFolder)
4039
.then((result) => {
41-
assert.equal(result.response.statusCode, HttpStatusCode.OK);
40+
assert.equal(result.response.statusCode, 200);
4241
});
4342
});
4443
});

0 commit comments

Comments
 (0)