1 | import * as postmark from "../../src/index";
|
2 |
|
3 | import { expect } from "chai";
|
4 | import "mocha";
|
5 |
|
6 | import * as nconf from "nconf";
|
7 | const testingKeys = nconf.env().file({ file: __dirname + "/../../testing_keys.json" });
|
8 |
|
9 | describe("Bounce", () => {
|
10 | const serverToken: string = testingKeys.get("SERVER_TOKEN");
|
11 | const client = new postmark.ServerClient(serverToken);
|
12 |
|
13 | it("getBounce", async () => {
|
14 | const bounces = await client.getBounces();
|
15 | const bounce = await client.getBounce(bounces.Bounces[0].ID);
|
16 | expect(bounce.ID).to.be.gte(0);
|
17 | });
|
18 |
|
19 | describe("invalid", () => {
|
20 | it("getBounce", () => {
|
21 | return client.getBounces({ count: -1, offset: 0 }).catch((error) => {
|
22 | expect(error.name).to.eq("ApiInputError");
|
23 | });
|
24 | });
|
25 | });
|
26 |
|
27 | it("getBounces", async () => {
|
28 | const bounces = await client.getBounces();
|
29 | expect(bounces.TotalCount).to.be.gte(0);
|
30 | });
|
31 |
|
32 | it("getBounceBump", async () => {
|
33 | const bounces = await client.getBounces();
|
34 | const bounceDump = await client.getBounceDump(bounces.Bounces[0].ID);
|
35 | expect(bounceDump.Body.length).to.be.gt(0);
|
36 | });
|
37 | });
|