Skip to content

Commit 1e10d77

Browse files
test: add unit test for MailtrapClient to verify correct behavior when accountId is provided without testInboxId
1 parent d7f7042 commit 1e10d77

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/__tests__/lib/mailtrap-client.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ describe("lib/mailtrap-client: ", () => {
709709
it("rejects with Mailtrap error, when `accountId` is missing.", () => {
710710
const client = new MailtrapClient({
711711
token: "MY_API_TOKEN",
712-
testInboxId: 5,
713712
});
714713

715714
expect.assertions(1);
@@ -721,11 +720,21 @@ describe("lib/mailtrap-client: ", () => {
721720
}
722721
});
723722

723+
it("returns testing API object when accountId is provided, even without testInboxId", () => {
724+
const client = new MailtrapClient({
725+
token: "MY_API_TOKEN",
726+
accountId: 123,
727+
// testInboxId is intentionally omitted
728+
});
729+
expect.assertions(1);
730+
731+
const testingClient = client.testing;
732+
expect(testingClient).toBeInstanceOf(TestingAPI);
733+
});
734+
724735
it("returns testing API object, console warn is called twice.", () => {
725736
const client = new MailtrapClient({
726737
token: "MY_API_TOKEN",
727-
sandbox: true,
728-
testInboxId: 10,
729738
accountId: 10,
730739
});
731740
expect.assertions(1);

0 commit comments

Comments
 (0)