1. 11 May, 2021 3 commits
    • Robert Knight's avatar
      Convert remaining promise chains to async/await · c4612eda
      Robert Knight authored
      Convert remaining promise chains in `PDFMetadata` tests to async/await.
      c4612eda
    • Robert Knight's avatar
      Refactor `getMetadata` tests · bfe5d42b
      Robert Knight authored
       - Convert promise chains to async/await
      
       - Add missing tests to check that the PDF URL and fingerprint URL
         appear in the object returned by `getMetadata`. These were previously
         tested indirectly in other tests.
      
       - Change tests to only check the specific properties of the returned
         object that are of interest. This reduces the changes needed when
         tests change unrelated parts of the output.
      bfe5d42b
    • Robert Knight's avatar
      Refactor test setup in `PDFMetadata` tests · 1b539b87
      Robert Knight authored
      Refactor the setup steps in PDFMetadata tests to make it easier
      to customize the PDF metadata exposed by the fake PDF.js environment.
      Instead of creating a fake `PDFViewerApplication` and `PDFMetadata`
      instance before each test, provide a helper function that creates both
      using the provided metadata.
      1b539b87
  2. 10 May, 2021 19 commits
  3. 07 May, 2021 5 commits
    • Robert Knight's avatar
      Change callback prop return type from `any` to `void` · 47e346e0
      Robert Knight authored
      This ensures that the component doesn't attempt to call the prop and use
      the result.
      47e346e0
    • Robert Knight's avatar
      Adjust condition ordering · 79be98b0
      Robert Knight authored
      As noted in PR review, checking for a valid annotation first seems more
      sensible.
      79be98b0
    • Robert Knight's avatar
      Correct a typo · 93700b5e
      Robert Knight authored
      93700b5e
    • Robert Knight's avatar
      Make service-using components typecheck correctly · 4be722ea
      Robert Knight authored
      Previously all components that used injected services did not have their
      usage type-checked because `withServices` returned `any`.
      
      This commit refactors the API of `withServices` to make it easier to
      typecheck and adds types. The major API change is that the list of injected
      services is now passed as a second argument to `withServices` rather
      than by setting an `injectedProps` property on the component. This makes
      it easy to infer that the component returned by `withServices(Widget,
      ['serviceA', 'serviceB'])` has the same props as `Widget` but without
      `serviceA` or `serviceB`.
      
      Making these changes also turned up a handful of mistakes in existing
      types which are fixed here:
      
       - Correct `auth` type used by `HelpPanel`
       - Correct type of `thread` prop used by `ThreadCard`
       - Correct optionality of boolean arguments in callbacks to `Excerpt`
       - Change `showActions` logic in `Annotation` to make it more obvious
         to TS that the actions are only shown when there is an annotation
       - Remove unused props passed to `GroupList`
      
      Additionally there was a type error with TopBar's `auth` prop which is
      less trivial to fix, so I have punted it to a future commit.
      4be722ea
    • Robert Knight's avatar
      Fix prop typechecking for `TopBar` component · 1a447624
      Robert Knight authored
      The type of the `props` argument to `TopBar` was not specified, so its
      props were not type-checked. Specifying a type for `props` turned up
      several mistakes in other types.
      
       - Specify the type of the `props` object so that the props are actually
         type-checked
       - Add missing `status` field to `AuthState` type
       - Correctly set the optionality of various props
      1a447624
  4. 06 May, 2021 6 commits
  5. 03 May, 2021 7 commits