-
Notifications
You must be signed in to change notification settings - Fork 9
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
Added unit tests for subscriptions #35
base: master
Are you sure you want to change the base?
Added unit tests for subscriptions #35
Conversation
Added sms and email opt-in e2e tests for sitegen Moved global variables to module Added unit test for subscriptions Refactored order confirmation unit test Setup mock for KlaviyoSubscribeProfilesService Refactor Site and LocalServiceRegistry Mocks Completed subscriber tests
3f5e372
to
c0ef967
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emarty-maze If I'm reading these correctly, these tests evaluate the klaviyo API response when requests are made but don't evaluate the actual behavior of the cartridge code. The code has different behavior in terms of what requests it makes and how many requests are made depending on the phone_number and email that are submitted. I'd like to see these conditionals in the subscribeUser
function covered. For example the case for email consent if we receive a 400 with the response indicating an invalid phone number that we should retry the consent request without the phone number. There should be a test verifying that this request is made twice given the 400 API response.
Responses from the API can be mocked but we should be testing that requests are made as expected with the correct arguments and that logging occurs as expected where relevant. Let me know if I need to clarify this, happy to jump on a quick call to discuss!
Hi Claire, thaks for the clarification, and sorry for missing those testing
requirements. A call would be great. Let me know a good time for Tuesday
(7/25).
…On Thu, Jul 20, 2023, 6:28 PM Claire Kolln (Integrations Ecom) < ***@***.***> wrote:
***@***.**** requested changes on this pull request.
@emarty-maze <https://github.com/emarty-maze> If I'm reading these
correctly, these tests evaluate the klaviyo API response when requests are
made but don't evaluate the actual behavior of the cartridge code. The code
has different behavior in terms of what requests it makes and how many
requests are made depending on the phone_number and email that are
submitted. I'd like to see these conditionals in the subscribeUser
function covered. For example the case for email consent if we receive a
400 with the response indicating an invalid phone number that we should
retry the consent request without the phone number. There should be a test
verifying that this request is made twice given the 400 API response.
Responses from the API can be mocked but we should be testing that
requests are made as expected with the correct arguments and that logging
occurs as expected where relevant. Let me know if I need to clarify this,
happy to jump on a quick call to discuss!
—
Reply to this email directly, view it on GitHub
<#35 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASLFA3R6OQPRBS4P5XT5I33XRGWINANCNFSM6AAAAAA2PEJ72Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Added sms and email opt-in e2e tests for sitegen
Moved global variables to module
Refactored order confirmation unit test
Setup mock for KlaviyoSubscribeProfilesService
Refactor Site and LocalServiceRegistry Mocks
Completed subscriber tests
Manual Testing Steps
test
dirnpm install
npm run test:unit
Pre-Submission Checklist:
NOTE: Please use the Changelogger cli tool to manage versioned file upgrades.
I followed cases from the following google doc: https://docs.google.com/document/d/1e4p75l_w0P6QfTqWja6sW8rfHGtNbvE5NWXxYszYne4/edit