Skip to content

Refactor data tests to cover all supported content types #656

@lkitching

Description

@lkitching

The draftset data endpoints support uploading or requesting data in various content types. However, many of the tests only test these routes with a single content type, either directly or by using a test hepler function which hard-codes the content type. See for example get-draftset-quads-data which fetches the data using the get-user-draftset-quads-through-api hepler, which specifies the n-quads content type.

It should be possible to test all supported content types within each of these tests by refactoring the tests and helpers to be parameterised by content type and looping over all supported media types e.g.

(t/deftest get-draftset-quads-data
  ;; create draft and append data
  (doseq [format conneg/show-data-formats]
    (t/testing (str "Get data in format: " format)
      (let [quads (help/get-user-draftset-quads-through-api hander draftest test-editor format)
             expected ...]
        (t/is (= (set quads) (set expected)))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions