Skip to content

Test all of the `diffs_metadata.json` handling through `prepareDiffData`

What does this MR do?

At the moment, our only tests cover the "normal" way diff files are sent to prepareDiffData: from a fetch of the diff files.

However, other "diff files" are also sent through prepareDiffData when the fetchDiffFilesMeta action is called.

These aren't really "diff files" in the sense that you would normally think of them: they don't have ANY of the relevant diff information (like lines of code, blob or viewer information, or commit information). But, they still go through the same processing so that all the functions that rely on "diff files" downstream can expect the same pre-processing.

This MR adds a suite of tests for the prepareDiffData util function to test how it behaves when given metadata diff files.

It also adds a real metadata mock file so that existing tests for the fetchDiffFilesMeta actually test the behavior of that action instead of blank arrays and objects.

Screenshots

N/A all ~backstage

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Merge request reports