{"size": 2560, "ext": "js", "max_stars_repo_path": "src/filters/__tests__/addTrackingData.test.js", "max_stars_repo_name": "adeira/ship", "max_stars_repo_stars_event_min_datetime": "2020-08-24T06:51:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T15:41:51.000Z", "max_issues_repo_path": "src/filters/__tests__/addTrackingData.test.js", "max_issues_repo_name": "adeira/ship", "max_issues_repo_issues_event_min_datetime": "2021-04-05T20:46:08.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-05T23:29:31.000Z", "max_forks_repo_path": "src/filters/__tests__/addTrackingData.test.js", "max_forks_repo_name": "adeira/shipit", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 18, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 29.7674418605, "max_line_length": 78, "alphanum_fraction": 0.63671875}
// @flow strict-local

import addTrackingData from '../addTrackingData';
import Changeset from '../../Changeset';

it('adds tracking data', () => {
  const changeset = new Changeset()
    .withID('MOCK_COMMIT_ID')
    .withAuthor('John Doe')
    .withSubject('Commit subject')
    .withDescription('Commit description');

  expect(changeset).toMatchInlineSnapshot(`
    Changeset {
      "author": "John Doe",
      "coAuthorLines": Array [],
      "debugMessages": Array [],
      "description": "Commit description",
      "id": "MOCK_COMMIT_ID",
      "subject": "Commit subject",
    }
  `);

  expect(addTrackingData(changeset)).toMatchInlineSnapshot(`
    Changeset {
      "author": "John Doe",
      "coAuthorLines": Array [],
      "debugMessages": Array [
        "ADD TRACKING DATA: \\"adeira-source-id: MOCK_COMMIT_ID\\"",
      ],
      "description": "Commit description

    adeira-source-id: MOCK_COMMIT_ID",
      "id": "MOCK_COMMIT_ID",
      "subject": "Commit subject",
    }
  `);
});

it('adds tracking data with Co-authored-by line', () => {
  const changeset = new Changeset()
    .withID('MOCK_COMMIT_ID')
    .withAuthor('John Doe')
    .withSubject('Commit subject')
    .withDescription('Commit description')
    .withCoAuthorLines([
      'Co-authored-by: Trond Bergquist <trond_bergquist@hotmail.com>',
      'Co-authored-by: Patricia Bergquist <patricia_bergquist@hotmail.com>',
    ]);

  expect(changeset).toMatchInlineSnapshot(`
    Changeset {
      "author": "John Doe",
      "coAuthorLines": Array [
        "Co-authored-by: Trond Bergquist <trond_bergquist@hotmail.com>",
        "Co-authored-by: Patricia Bergquist <patricia_bergquist@hotmail.com>",
      ],
      "debugMessages": Array [],
      "description": "Commit description",
      "id": "MOCK_COMMIT_ID",
      "subject": "Commit subject",
    }
  `);

  expect(addTrackingData(changeset)).toMatchInlineSnapshot(`
    Changeset {
      "author": "John Doe",
      "coAuthorLines": Array [
        "Co-authored-by: Trond Bergquist <trond_bergquist@hotmail.com>",
        "Co-authored-by: Patricia Bergquist <patricia_bergquist@hotmail.com>",
      ],
      "debugMessages": Array [
        "ADD TRACKING DATA: \\"adeira-source-id: MOCK_COMMIT_ID\\"",
      ],
      "description": "Commit description

    adeira-source-id: MOCK_COMMIT_ID

    Co-authored-by: Trond Bergquist <trond_bergquist@hotmail.com>
    Co-authored-by: Patricia Bergquist <patricia_bergquist@hotmail.com>",
      "id": "MOCK_COMMIT_ID",
      "subject": "Commit subject",
    }
  `);
});
