Skip to content

Commit fcd8347

Browse files
author
Andrey
committed
Added additional tests
- Watermark - Replace content
1 parent 51ba348 commit fcd8347

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

files/document.docx.pdf

-54 Bytes
Binary file not shown.

files/new.pdf

72 Bytes
Binary file not shown.

files/optimized_webviewer.pdf

-2 Bytes
Binary file not shown.
422 Bytes
Binary file not shown.
-368 Bytes
Binary file not shown.

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ app.get('/generate/:filename', (req, res) => {
139139
PDFNetEndpoint(main, outputPath, res);
140140
});
141141

142-
app.get('/textextract/:filename-:pagenumber', (req, res) => {
142+
app.get('/textExtract/:filename-:pagenumber', (req, res) => {
143143
const filename = req.params.filename;
144144
let pageNumber = Number(req.params.pagenumber);
145145
let ext = path.parse(filename).ext;

test/test.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('/GET generate/filename', () => {
7878
});
7979
});
8080

81-
describe('/GET textextract/filename', () => {
81+
describe('/GET textExtract/filename', () => {
8282
it('it should GET text from PDF page 1', (done) => {
8383
chai.request(server)
8484
.get('/textextract/webviewer.pdf-1')
@@ -90,3 +90,27 @@ describe('/GET textextract/filename', () => {
9090
});
9191
});
9292
});
93+
94+
describe('/GET replaceContent/filename', () => {
95+
it('it should GET a newly generated PDF document with strings replaced', (done) => {
96+
chai.request(server)
97+
.get('/replaceContent/John_Smith')
98+
.end((err, res) => {
99+
chai.expect(res.status).to.equal(200);
100+
chai.expect(res.type).to.equal(mimeType['.pdf']);
101+
done();
102+
});
103+
});
104+
});
105+
106+
describe('/GET watermark/filename', () => {
107+
it('it should GET a watermarked PDF document', (done) => {
108+
chai.request(server)
109+
.get('/watermark/webviewer.pdf-amazing')
110+
.end((err, res) => {
111+
chai.expect(res.status).to.equal(200);
112+
chai.expect(res.type).to.equal(mimeType['.pdf']);
113+
done();
114+
});
115+
});
116+
});

0 commit comments

Comments
 (0)