Skip to content
Snippets Groups Projects
matcher_test.go 892 B
Newer Older
  • Learn to ignore specific revisions
  • package matcher
    
    
    import (
    	"strings"
    	"testing"
    )
    
    
    func Test_sendMailToMandater(t *testing.T) {
    
    	recorder := SetTestModeAndReturnRecorder()
    
    	type args struct {
    		email   string
    		mandate string
    		sirent  string
    		token   string
    	}
    	tests := []struct {
    		name    string
    		args    args
    		wantErr bool
    	}{
    		{"should work", args{"nicolas@alpha.grandlyon.com", "Mandataire", "Sirent", "TheToken"}, false},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    
    Nicolas Pernoud's avatar
    Nicolas Pernoud committed
    			if err := sendMailToMandater(tt.args.email, tt.args.mandate, tt.args.sirent, tt.args.token, "http://localhost"); (err != nil) != tt.wantErr {
    
    				t.Errorf("sendMailToMandater() error = %v, wantErr %v", err, tt.wantErr)
    			}
    
    			if !strings.Contains(recorder.Msg(), "Demande de mandatement") || !strings.Contains(recorder.Msg(), "http://localhost") {
    				t.Errorf("received body is not what is expected")
    			}