github.com/bitcubate/cryptojournal@v1.2.5-0.20171102134152-f578b3d788ab/src/lib/mail/adapters/sendgrid/sendgrid_test.go (about)

     1  package sendgrid
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/bitcubate/cryptojournal/src/lib/mail"
     7  )
     8  
     9  // TestSendGrid tests we can create a new sendgrid connection
    10  // without mocking we can't really test an actual send
    11  func TestSendGrid(t *testing.T) {
    12  
    13  	// TODO add some proper tests here.
    14  
    15  	s := New("from@example.com", "secret")
    16  	if s.secret != "secret" {
    17  		t.Errorf("sendgrid: failed to set up")
    18  	}
    19  
    20  	email := mail.New("example@example.com")
    21  	err := s.Send(email)
    22  	if err == nil {
    23  		t.Errorf("sendgrid: failed to error on bad emails")
    24  	}
    25  
    26  }