No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [solved] Testing/Mocking Quasar File Uploader in Jest

    Help
    1
    2
    115
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • beatscribe
      beatscribe last edited by beatscribe

      So I have a standard Uploader setup in my Quasar v1 project, the file is just submitted via API. I am super unclear on how to make Jest test for this. I can make a simple Express server and just actually hit that API and get a response, but it seems like there might be a better way to mock the response in Jest. Has anyone else done such a unit test?

      1 Reply Last reply Reply Quote 0
      • beatscribe
        beatscribe last edited by

        So it isn’t idea, but I came up with this:

        In Jest, I test the functions the completed/failed events from QUploader call. Thats about the best I could do there.
        In Cypress e2e, I use Interceptor and cypress-upload package to mock an upload and the response from the API call and then actually have cypress click the upload button and judge what happens after.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post