Skip to content

Commit b35adc6

Browse files
authored
Merge pull request #6 from hsharghi/scheduled
fix EmailAddress init from String
2 parents e7946fd + 8b6dc36 commit b35adc6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Sources/Resend/Models/Request/Email/EmailAddress.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct EmailAddress: Decodable {
2323

2424
extension EmailAddress: ExpressibleByStringLiteral {
2525
public init(stringLiteral email: StringLiteralType) {
26-
self.init(email: email)
26+
self.init(from: email)
2727
}
2828
}
2929

Tests/SwiftResendTests/SwiftResendTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ final class SwiftResendTests: XCTestCase {
1919
try await httpClient.shutdown()
2020
}
2121

22+
23+
func testEmailAddressFromString() {
24+
let email1: EmailAddress = "hadi<hadi123@example.com>"
25+
XCTAssertEqual(email1.email, "hadi123@example.com")
26+
XCTAssertEqual(email1.name, "hadi")
27+
}
28+
2229
func testSend() async throws {
2330
let id = try await resend.emails.send(email: .init(
2431
from: .init(email: "hadi@example.com", name: "Hadi"),

0 commit comments

Comments
 (0)