Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate SmsFactory to Typescript #387

Merged
merged 14 commits into from
Oct 5, 2020
Merged

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Sep 30, 2020

Problem

This PR migrates SmsFactory to Typescript. sms.* related files are also moved to services/sms directory for better encapsulation.

Related to #144

Note that this PR is purely for migrating sms factory and encapsulating related files under a service directory. There are still work to do regarding the sms module -- adding specific errors, adding neverthrow to the service functions, etc. This should be done in a separate PR.

Solution

Improvements:

  • SmsFactory is migrated to Typescript
  • Tests for sms service files are now nested under services/sms/__tests__

Tests

  • Previous jasmine tests for sms.service has now been rewritten in jest with Typescript with additional tests for sendAdminContactOtp
  • Add tests for sms.factory

import { sendAdminContactOtp, sendVerificationOtp } from './sms.service'
import { TwilioConfig } from './sms.types'

interface ISmsFactory {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move these to the types folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use typeof to get the types leh, I scared circular dependency :X

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment for future developers?

Copy link
Contributor

@arshadali172 arshadali172 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up my slack and adding tests!

@karrui karrui merged commit df08618 into develop Oct 5, 2020
@karrui karrui deleted the ref/ts-smsfactory branch October 5, 2020 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants