@@ -1329,6 +1329,7 @@ func TestNotificationTemplates_Golden(t *testing.T) {
1329
1329
1330
1330
wantBody , err := os .ReadFile (goldenFile )
1331
1331
require .NoError (t , err , fmt .Sprintf ("missing golden notification body file. %s" , hint ))
1332
+ wantBody = normalizeLineEndings (wantBody )
1332
1333
require .Equal (t , wantBody , content , fmt .Sprintf ("smtp notification does not match golden file. If this is expected, %s" , hint ))
1333
1334
})
1334
1335
})
@@ -1339,7 +1340,11 @@ func TestNotificationTemplates_Golden(t *testing.T) {
1339
1340
// Required for Windows compatibility.
1340
1341
func normalizeLineEndings (content []byte ) []byte {
1341
1342
content = bytes .ReplaceAll (content , []byte ("\r \n " ), []byte ("\n " ))
1342
- return bytes .ReplaceAll (content , []byte ("\r " ), []byte ("\n " ))
1343
+ content = bytes .ReplaceAll (content , []byte ("\r " ), []byte ("\n " ))
1344
+ // some tests generate escaped line endings, so we have to replace them too
1345
+ content = bytes .ReplaceAll (content , []byte ("\\ r\\ n" ), []byte ("\\ n" ))
1346
+ content = bytes .ReplaceAll (content , []byte ("\\ r" ), []byte ("\\ n" ))
1347
+ return content
1343
1348
}
1344
1349
1345
1350
func normalizeGoldenEmail (content []byte ) []byte {
@@ -1362,7 +1367,6 @@ func normalizeGoldenEmail(content []byte) []byte {
1362
1367
content = dateRegex .ReplaceAll (content , []byte ("Date: " + constantDate ))
1363
1368
content = messageIDRegex .ReplaceAll (content , []byte ("Message-Id: " + constantMessageID ))
1364
1369
content = bytes .ReplaceAll (content , boundary , []byte (constantBoundary ))
1365
- content = normalizeLineEndings (content )
1366
1370
1367
1371
return content
1368
1372
}
0 commit comments