Skip to content

Fix many unit tests

Erwan Rouchet requested to merge fix-tests into master

While working on #738 (closed), I noticed some unit tests were actually failing or not testing anything. I went through the logs and found an awful lot of tests with errors like unknown API calls that were just shown as warnings, or Vue warnings about missing properties or stubs. This fixes a large amount of them, although there probably still are more remaining that are much harder to see. I don't think there are any simple ways to ensure those bugs no longer occur; many unhandled promise rejection warnings are false positives as they are actually handled, for example in tests that check for API error handling (#446 (closed)).

Combing through the logs made me find some bugs, including #743 (closed) which I am putting in a separate PR since it is a bug that can exist beyond the unit tests.

  • Missing RouterLinkStubs in PasswordResetConfirm, WorkersActivity, Workers/Versions/Details causing warnings
  • Added a proper assertion of the router-link in Workers/Versions/Details
  • Fixed a Vue warning about mutating a prop in Element/Metadata/Metadata
  • Removed a duplicate call to ListCorpusAllowedMetaData that could also occur outside of unit tests
  • Fixed multiple Vue warnings about missing props in EditableTranscription
  • Fixed 404 errors in the element selection deletion component tests, and added proper store history testing
  • Added proper jobs listing tests when testing the selection deletion in the store
  • Fixed a 404 error in the worker list tests
  • Prevented Process/Filter from listing a process' elements when the process is not a Workers process; that query is useless since the user gets redirected to a 404 afterwards
  • Prevented Process/Configure from listing a process' WorkerRuns when the process is not a Workers process; that query is useless since the user gets redirected to a 404 afterwards
  • Added proper testing of the automatic selection loading after logging in
  • Fixed an issue in our own test harness in which the order in which mock API calls are created can affect the called handlers assertions
  • Updated the DetailsPanel to just deselect any element after deleting instead of selecting the main element, which caused bugs in the tests and could cause issues when using the ChildrenTree in a folder
Edited by Erwan Rouchet

Merge request reports

Loading