Uploaded image for project: 'Opencast'
  1. MH-12605

Mocking get-requests in frontend tests sometimes results in empty arrays instead of the configured JSON content

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed and reviewed
    • Affects versions: 5.0
    • Fix versions: 5.0
    • Components: Tests
    • Labels:
      None
    • Severity:
      Tests
    • Steps to reproduce:
      Hide
      Steps to reproduce:
      1. When mocking get-requests in frontend tests using getJSONFixture(Path), the JSON in the response is already parsed into an object or array, contrarily to a real request, where the response will contain a string yet to be parsed. (See bulkDeleteControllerSpec.js for an example.)
      2. When trying to parse the JSON for a second time, some ressources fail silently (e.g. by swallow the exception) and return an empty array or similar instead of the expected JSON content (for example newEventProcessingRessource.js).
      3. It is unclear how many tests and ressources are affected.
       
       Actual Results: An Empty Array or similar.
       
       
       Expected Results: The content of the configured json file used for testing.

      Desired Behaviour:
      1. Mocked Responses in frontend tests should contain a string instead of an already parsed JSON-Object.
      2. Ressources shouldn't swallow exceptions when parsing as a JSON fails.
       
       
       Workaround (if any): -
      Show
      Steps to reproduce: 1. When mocking get-requests in frontend tests using getJSONFixture(Path), the JSON in the response is already parsed into an object or array, contrarily to a real request, where the response will contain a string yet to be parsed. (See bulkDeleteControllerSpec.js for an example.) 2. When trying to parse the JSON for a second time, some ressources fail silently (e.g. by swallow the exception) and return an empty array or similar instead of the expected JSON content (for example newEventProcessingRessource.js). 3. It is unclear how many tests and ressources are affected.    Actual Results: An Empty Array or similar.      Expected Results: The content of the configured json file used for testing. Desired Behaviour: 1. Mocked Responses in frontend tests should contain a string instead of an already parsed JSON-Object. 2. Ressources shouldn't swallow exceptions when parsing as a JSON fails.      Workaround (if any): -

      TestRail: Results

        Attachments

          Activity

            People

            • Assignee:
              kihler Katrin Ihler
              Reporter:
              kihler Katrin Ihler
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                TestRail: Cases