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

Issue/react unit tests - Part 1 #1452

Conversation

cayb0rg
Copy link
Contributor

@cayb0rg cayb0rg commented Mar 1, 2023

Note: This adds the dependency package "jest-environment-dom" to package.json.

Run rm -rf node_modules && yarn install to update

React Unit Tests Part One

This PR only covers the following tests:

  • Widget Player (widget-player.test.js)
  • Widget Creator (widget-creator.test.js)
  • Admin Widgets (widget-admin-page.test.js)
  • Admin Instances (support-page.test.js)

To run, use the command:
yarn test widget-player.test.js widget-creator.test.js support-page.test.js widget-admin-page.test.js

Running yarn test will include tests from the old dashboard as well as tests that have not been implemented (such as the collaborator and settings dialog).

Issues fixed

Widget Admin

  • Widget Admin not displaying error message on failed saves
  • Replacing Materia.Image.iconUrl with /util/icon-url.js

Widget Creator

  • Pressing "Save Draft" doesn't change the text back after it saves (stays on "Saving...")
  • Clicking "Update" in published widgets displays the Publish banner instead

Support / Admin Pages

  • Includes user support role in User Admin
  • The to_array function used by users_search and user_get now sets is_support_user based on searched user's ID instead of the current ID
  • Make it so open_at dates must come before close_at dates
  • Fixes name not updating in Admin Instance
  • Copying a widget with 'Grant Access' on should set include current user as owner of copied widget
  • Moves OnCopy to SupportSelectedInstance from the parent SupportPage

Collaborate Dialog

  • Collaborate Dialog should show support users if they are collaborators

Other Issues Fixed

  • Prefixes the widget admin files with widget-admin for organizational purposes.

History

This was originally #1402. However, since that PR, the creator and player race issues have been solved. I pulled the unit tests from that PR and updated them to account for new changes.

Pages to do in future parts

  • Admin Users
  • Question Importer
  • Media Importer
  • Widget Catalog
  • My Widgets Page
  • Copy dialog
  • Collaborator dialog
  • Settings dialog

@clpetersonucf clpetersonucf added the React Branch Related to the React rewrite for Materia label Mar 22, 2023
@cayb0rg cayb0rg changed the title Issue/react unit tests Issue/react unit tests - Part 1 Apr 18, 2023
Copy link
Member

@clpetersonucf clpetersonucf left a comment

Choose a reason for hiding this comment

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

There's a LOT here but as best I can tell, it looks good, and the tests all pass. Great work.

@clpetersonucf clpetersonucf merged commit fd51500 into ucfopen:issue/support-dashboard-in-react Aug 23, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
React Branch Related to the React rewrite for Materia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants