@@ -344,9 +344,9 @@ func Test_formatContentVariables(t *testing.T) {
344344 messageType : MessageTypeReceiverOTP ,
345345 vars : map [TemplateVariable ]string {
346346 TemplateVarReceiverOTP : "123456" ,
347- TemplateVarOrgName : "MyOrg" ,
347+ TemplateVarOrgName : "MyOrg" , // extra variable is allowed but ignored
348348 },
349- wantResult : `{"1":"123456","2":"MyOrg" }` ,
349+ wantResult : `{"1":"123456"}` ,
350350 },
351351 {
352352 name : "unsupported message type" ,
@@ -362,17 +362,17 @@ func Test_formatContentVariables(t *testing.T) {
362362 vars : map [TemplateVariable ]string {
363363 TemplateVarOrgName : "Test Organization" ,
364364 },
365- wantErr : "expected 2 template variables for message type receiver_invitation, got 1 " ,
365+ wantErr : "missing required template variable registration_link for message type receiver_invitation" ,
366366 },
367367 {
368- name : "too many variables for receiver OTP" ,
368+ name : "extra variables are allowed for receiver OTP" ,
369369 messageType : MessageTypeReceiverOTP ,
370370 vars : map [TemplateVariable ]string {
371371 TemplateVarReceiverOTP : "123456" ,
372372 TemplateVarOrgName : "MyOrg" ,
373373 TemplateVarFirstName : "Extra" ,
374374 },
375- wantErr : "expected 2 template variables for message type receiver_otp, got 3" ,
375+ wantResult : `{"1":"123456"}` , // extra variables are ignored
376376 },
377377 {
378378 name : "incorrect variable for receiver invitation" ,
@@ -381,7 +381,7 @@ func Test_formatContentVariables(t *testing.T) {
381381 TemplateVarOrgName : "Test Organization" ,
382382 TemplateVarFirstName : "Wrong Variable" ,
383383 },
384- wantErr : "missing template variable registration_link for message type receiver_invitation" ,
384+ wantErr : "missing required template variable registration_link for message type receiver_invitation" ,
385385 },
386386 {
387387 name : "incorrect variable for receiver OTP" ,
@@ -390,13 +390,13 @@ func Test_formatContentVariables(t *testing.T) {
390390 TemplateVarFirstName : "Wrong Variable" ,
391391 TemplateVarOrgName : "MyOrg" ,
392392 },
393- wantErr : "missing template variable receiver_otp for message type receiver_otp" ,
393+ wantErr : "missing required template variable receiver_otp for message type receiver_otp" ,
394394 },
395395 {
396396 name : "empty variables map for receiver invitation" ,
397397 messageType : MessageTypeReceiverInvitation ,
398398 vars : map [TemplateVariable ]string {},
399- wantErr : "expected 2 template variables for message type receiver_invitation, got 0 " ,
399+ wantErr : "missing required template variable " ,
400400 },
401401 }
402402
0 commit comments