emailing-and-texting-script icon indicating copy to clipboard operation
emailing-and-texting-script copied to clipboard

Create Tests

Open oyekanmiayo opened this issue 4 years ago • 3 comments

Didn't follow TDD on this one 😅. It works well thankfully, but it is ideal to have some tests.

Here are the test cases I can think of at the moment:

  • Test that getCommunicationObjects() reads the JSON files well
  • Test that dispatchCommunication() is called at the right cron
  • Test that sendSms() in SmsSender doesn't call Twilio for null or empty objects and for numbers that don't start with +234
  • Test that sendSms() in SmsSender is retried when there is an exception
  • Test that sendEmail() in EmailSender doesn't call JavaMailSender for null or empty emails addresses or messages
  • Test that sendEmail() in EmailSender is retried when there is an exception

oyekanmiayo avatar Oct 11 '20 07:10 oyekanmiayo

Can I tackle the first test (getCommunicationObjects())?

Keenal avatar Oct 11 '20 23:10 Keenal

Can I tackle the first test (getCommunicationObjects())?

@Keenal yes, you can!

oyekanmiayo avatar Oct 11 '20 23:10 oyekanmiayo

What are we comparing the method with? Since the method's (getCommunicationObject()) return type is void, should we just check if the file exists? Or what should the objectMapper be returning? I wrote the test, I just need a correct answer to test it against.

Keenal avatar Oct 13 '20 03:10 Keenal