Skip to content

add deep rendering tests to workshop form js - #51226

Merged
davidsbailey merged 3 commits into
stagingfrom
workshop-form-js-test
Apr 11, 2023
Merged

add deep rendering tests to workshop form js#51226
davidsbailey merged 3 commits into
stagingfrom
workshop-form-js-test

Conversation

@davidsbailey

@davidsbailey davidsbailey commented Apr 8, 2023

Copy link
Copy Markdown
Member

Related to https://codedotorg.atlassian.net/browse/ACQ-462. This adds a first enzyme mount test for the workshop form. For more background, see workshop form refactor proposal.

links

Testing story

Improves existing test coverage

@davidsbailey
davidsbailey marked this pull request as ready for review April 10, 2023 19:00
@davidsbailey davidsbailey changed the title Workshop form js test add deep rendering tests to workshop form js Apr 10, 2023
@davidsbailey
davidsbailey requested a review from a team April 10, 2023 19:22

@TurnerRiley TurnerRiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the super detailed work through the proposal doc and through setting this up! For my own understanding, what does the component allow us to do here? I'm reading about it now but don't quite understand what it would be doing here?

@davidsbailey

Copy link
Copy Markdown
Member Author

Thank you for the super detailed work through the proposal doc and through setting this up! For my own understanding, what does the component allow us to do here? I'm reading about it now but don't quite understand what it would be doing here?

Hey Turner, are you asking about the WorkshopForm component? this component allows viewing, creating and editing of workshops in the workshop dashboard ui. the screenshots in the doc are a bit small so here they are in a more convenient format. I hope this helps, but please let me know if I misunderstood your question!

create

Screenshot 2023-04-05 at 12 56 22 PM

edit

Screenshot 2023-04-05 at 12 56 42 PM

let fakeWorkshop, store;

beforeEach(() => {
fakeWorkshop = Factory.build('workshop');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wow, I didn't know this was a thing!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this was also new to me!

.attr('sessions', () => Factory.buildList('session', 5))
.attr('account_required_for_attendance?', true)
.attr('scholarship_workshop?', true)
.attr('location_name', 'physical');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

TIL

it('renders csf intro workshop', () => {
const wrapper = mount(
<Provider store={store}>
<MemoryRouter>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also something new I learned! Thanks for getting this working.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I didn't know about it either! GPT-4 discovered it for me:

Screenshot 2023-04-11 at 9 47 27 AM

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Okay wow. That is seriously impressive ... excuse me while I let my head explode and then gather the pieces back together 🤯

@davidsbailey
davidsbailey merged commit 86d4bd0 into staging Apr 11, 2023
@davidsbailey
davidsbailey deleted the workshop-form-js-test branch April 11, 2023 16:52
@TurnerRiley

Copy link
Copy Markdown
Contributor

Thank you for the super detailed work through the proposal doc and through setting this up! For my own understanding, what does the component allow us to do here? I'm reading about it now but don't quite understand what it would be doing here?

Hey Turner, are you asking about the WorkshopForm component? this component allows viewing, creating and editing of workshops in the workshop dashboard ui. the screenshots in the doc are a bit small so here they are in a more convenient format. I hope this helps, but please let me know if I misunderstood your question!

create

Screenshot 2023-04-05 at 12 56 22 PM

edit

Screenshot 2023-04-05 at 12 56 42 PM

Oh shoot, I'm not sure what happened by I had typed "the MemoryRouter component" instead of just "the component" but I guess in rephrasing I accidentally deleted that. But you talked more about it with your ChatGPT response to Meg so I understand now, thank you!

@davidsbailey

Copy link
Copy Markdown
Member Author

Oh shoot, I'm not sure what happened by I had typed "the MemoryRouter component" instead of just "the component" but I guess in rephrasing I accidentally deleted that. But you talked more about it with your ChatGPT response to Meg so I understand now, thank you!

ahh, that makes more sense! yeah, it appears to be designed for testing with react router: https://reactrouter.com/en/main/router-components/memory-router

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.

3 participants