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

[Amplitude] Implement section setup complete/cancelled #49375

Merged
merged 15 commits into from
Jan 5, 2023

Conversation

rshipp
Copy link
Contributor

@rshipp rshipp commented Dec 5, 2022

Amplitude instrumentation for Section Setup Completed and Section Setup Cancelled events. Based on #49374.

When reviewing, please nitpick as much as you want, since this may be used as example code for other teams for later Amplitude instrumentation.

Links

Testing story

New unit tests, and manual testing locally.

@rshipp rshipp changed the title Implement section setup complete/cancelled [Amplitude] Implement section setup complete/cancelled Dec 5, 2022
@rshipp rshipp force-pushed the amplitude-section-completed branch from dcd65f6 to f1ce490 Compare December 6, 2022 17:24
Base automatically changed from bethany-and-ryan/amplitude to staging-next December 10, 2022 12:29
@rshipp rshipp force-pushed the amplitude-section-completed branch from 10afc1f to 46762f1 Compare January 5, 2023 16:52
@rshipp rshipp changed the base branch from staging-next to staging January 5, 2023 16:54
@rshipp rshipp requested a review from a team January 5, 2023 16:54
@@ -406,4 +408,78 @@ describe('EditSectionForm', () => {
const lessonExtrasField = wrapper.find('LessonExtrasField');
assert.equal(lessonExtrasField.length, 1);
});

it('sends completed event when save is clicked', () => {
const wrapper = mount(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need mount here to ensure the button calls the appropriate function?

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 don't actually know what mount does, I assumed from its usage elsewhere that's just how you instantiate React components. is there a different way that'd be better here?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can also use shallow, which renders just the top level component, whereas mount renders all the child component as well. We generally prefer using shallow over mount but there are cases where mount is necessary. I'm not 100% sure but I think this might be one of those cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests still pass with shallow, so that seems good!

const {section, courseOfferings, isNewSection} = this.props;

const courseName = courseOfferings.hasOwnProperty(section.courseOfferingId)
? courseOfferings[section.courseOfferingId].display_name
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking that we want the display_name here (which will change based on locale) and not the id?

(I added this comment below then realized it belonged here -- sorry for the duplicate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated based on slack discussion in e05f83c.

@rshipp rshipp marked this pull request as ready for review January 5, 2023 17:33
Copy link
Contributor

@bethanyaconnor bethanyaconnor left a comment

Choose a reason for hiding this comment

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

Looks good!

@rshipp rshipp merged commit b7b1d6c into staging Jan 5, 2023
@rshipp rshipp deleted the amplitude-section-completed branch January 5, 2023 19:47
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

3 participants