Skip to content

Commit 99b7f86

Browse files
authored
Merge pull request #13 from Doczilla-APP/improvements
test: Added specific test for screenshots
2 parents 0083b4b + 8504448 commit 99b7f86

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/__tests__/page.spec.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ describe('Page', () => {
1111

1212
axiosMock.onAny().reply(200, Buffer.from(''))
1313

14-
test('it encode the page.html option', async () => {
14+
beforeEach(() => {
15+
axiosMock.resetHistory()
16+
})
17+
18+
test('it encode the page.html option (pdf)', async () => {
1519
await client.pdf.direct({
1620
page: {
1721
html: '<div>Your first Doczilla PDF</div>'
@@ -26,4 +30,19 @@ describe('Page', () => {
2630
}))
2731
})
2832

33+
test('it encode the page.html option (screenshot)', async () => {
34+
await client.screenshot.direct({
35+
page: {
36+
html: '<div>Your first Doczilla PDF</div>'
37+
}
38+
})
39+
40+
expect(axiosMock.history.post.length).toBe(1)
41+
expect(axiosMock.history.post[0].data).toEqual(JSON.stringify({
42+
page: {
43+
html: 'PGRpdj5Zb3VyIGZpcnN0IERvY3ppbGxhIFBERjwvZGl2Pg=='
44+
}
45+
}))
46+
})
47+
2948
})

0 commit comments

Comments
 (0)