-
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.
Check if notification template compiles
Showing
1 changed file
with
60 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package notification | ||
|
||
import ( | ||
"github.com/AustrianDataLAB/GeWoScout/backend/models" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestGenerateEmailContentWithMinimalListing(t *testing.T) { | ||
listing := models.Listing{} | ||
|
||
emailContent, err := generateEmailContent(listing) | ||
|
||
if err != nil { | ||
t.Errorf("Expected no error, got %s", err) | ||
} | ||
if emailContent == "" { | ||
t.Error("Expected email content, got empty string") | ||
} | ||
} | ||
|
||
func TestGenerateEmailContentWithFullListing(t *testing.T) { | ||
listing := models.Listing{ | ||
ID: "123", | ||
PartitionKey: "123", | ||
Title: "Test Title", | ||
HousingCooperative: "Test Housing Cooperative", | ||
ProjectID: "123", | ||
ListingID: "123", | ||
Country: "Test Country", | ||
City: "Test City", | ||
PostalCode: "123", | ||
Address: "Test Address", | ||
RoomCount: 1, | ||
SquareMeters: 1, | ||
AvailabilityDate: "Test Availability Date", | ||
YearBuilt: new(int), | ||
HwgEnergyClass: new(string), | ||
FgeeEnergyClass: new(string), | ||
ListingType: "Test Listing Type", | ||
RentPricePerMonth: new(int), | ||
CooperativeShare: new(int), | ||
SalePrice: new(int), | ||
AdditionalFees: new(int), | ||
DetailsURL: "Test Details URL", | ||
PreviewImageURL: "Test Preview Image URL", | ||
ScraperID: "123", | ||
CreatedAt: time.Now(), | ||
LastModifiedAt: time.Now(), | ||
} | ||
|
||
emailContent, err := generateEmailContent(listing) | ||
|
||
if err != nil { | ||
t.Errorf("Expected no error, got %s", err) | ||
} | ||
if emailContent == "" { | ||
t.Error("Expected email content, got empty string") | ||
} | ||
} |