Skip to content

Commit

Permalink
Check if notification template compiles
Browse files Browse the repository at this point in the history
nspring00 committed Jun 26, 2024
1 parent fdac472 commit 6508be6
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions backend/notification/notification_test.go
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")
}
}

0 comments on commit 6508be6

Please sign in to comment.