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

Move integration tests #45175

Merged
merged 9 commits into from
Mar 7, 2022
Merged

Move integration tests #45175

merged 9 commits into from
Mar 7, 2022

Conversation

megcrenshaw
Copy link
Contributor

@megcrenshaw megcrenshaw commented Mar 7, 2022

As part of the TeacherApplication test refactor, I moved the tests requiring mount to a separate file. I originally had these in the integration directory, but I had to import enzyme for it to work (see 14d5c23). Instead, I kept it in the unit directory but with a different name.

Links

Testing story

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

// Also calls firehose event on submit, but we reload the page on submit
// The page reload can't be stubbed because `window.location.reload`
// is not writable nor configurable: Object.getOwnPropertyDescriptor(window.location, 'toString')
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#modifying_a_property
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 spent too long on this 😅 . We could do the window.location.reload in a separate function that we stub out, but then we'd have to export that function for the test here. I don't think there's a "good" way to test this––open to ideas

Copy link
Member

Choose a reason for hiding this comment

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

so we actually do have a util already specifically for this purpose:

export function reload() {
window.location.reload();
}
that is what I would recommend if you want to verify that a page reload has happened in a unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooo excellent––will update this!

@megcrenshaw megcrenshaw requested review from tim-dot-org and a team March 7, 2022 19:28
Copy link
Contributor

@tim-dot-org tim-dot-org left a comment

Choose a reason for hiding this comment

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

i think this is fine until we get a more holistic integration test approach. I don't think we'd want to run these separately (different karma/mocha config) anyways

@megcrenshaw megcrenshaw merged commit d8d38dc into staging Mar 7, 2022
@megcrenshaw megcrenshaw deleted the move-integration-tests branch March 7, 2022 20:42
@davidsbailey
Copy link
Member

thank you for doing this Meg! This seems like a step in the right direction. it would be great for our engineering team to get on the same page about js integration tests.

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