-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
export {assertEquals} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
export {dirname, fromFileUrl} from "https://deno.land/[email protected]/path/mod.ts"; | ||
export {exists} from "https://deno.land/[email protected]/fs/mod.ts"; | ||
export {delay} from "https://deno.land/[email protected]/async/mod.ts"; | ||
|
||
export {DOMParser} from "https://deno.land/x/[email protected]/deno-dom-wasm.ts"; | ||
export {DOMParser} from "https://deno.land/x/[email protected]/deno-dom-wasm.ts"; | ||
|
||
export {init as smtpTest} from "npm:[email protected]"; |
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 |
---|---|---|
@@ -1,20 +1,33 @@ | ||
import {assertEquals} from "../../deps.test.ts"; | ||
import {smtpSend} from "../../src/deno_ext/smtp.ts"; | ||
import {assertEquals, delay, smtpTest} from "../../deps.test.ts"; | ||
import {type MailMessage, smtpSend} from "../../src/deno_ext/smtp.ts"; | ||
|
||
const cs = ""; | ||
const em = ""; | ||
const sample:MailMessage = { | ||
from: "[email protected]", | ||
to: ["[email protected]"], | ||
title: "Test title", | ||
body: "Test body" | ||
}; | ||
|
||
Deno.test({ | ||
ignore: true, | ||
name: "SMTP: Send", | ||
async fn(){ | ||
await smtpSend(cs, { | ||
from: em, | ||
to: [em], | ||
title: "CI Test", | ||
body: "CI Test" | ||
const server = smtpTest(10025); | ||
const result = new Promise<MailMessage>((res)=>{ | ||
server.bind((_, __, {headers, body})=>{ | ||
res({ | ||
from: <string>headers.from, | ||
to: [<string>headers.to], | ||
title: <string>headers.subject, | ||
body: body ?? "" | ||
}); | ||
}); | ||
}); | ||
|
||
assertEquals(true, true); | ||
await smtpSend("smtp://127.0.0.1:10025", sample); | ||
await new Promise<void>(done => server.stop(done)); | ||
|
||
assertEquals(await result, sample); | ||
|
||
await delay(1000); | ||
} | ||
}); |
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