-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
- Loading branch information
Showing
2 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright 2024 New Vector Ltd. | ||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import { AbstractStartedContainer, GenericContainer, StartedTestContainer, Wait } from "testcontainers"; | ||
import mailhog from "mailhog"; | ||
|
||
export class MailhogContainer extends GenericContainer { | ||
constructor() { | ||
super("mailhog/mailhog:latest"); | ||
|
||
this.withExposedPorts(8025).withWaitStrategy(Wait.forListeningPorts()); | ||
} | ||
|
||
public override async start(): Promise<StartedMailhogContainer> { | ||
return new StartedMailhogContainer(await super.start()); | ||
} | ||
} | ||
|
||
export class StartedMailhogContainer extends AbstractStartedContainer { | ||
public readonly client: mailhog.API; | ||
|
||
constructor(container: StartedTestContainer) { | ||
super(container); | ||
this.client = mailhog({ host: container.getHost(), port: container.getMappedPort(8025) }); | ||
} | ||
} |