Welcome to mirror list, hosted at ThFree Co, Russian Federation.

commit_id.js « factories « test_helpers « frontend_integration « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9fa278c9ddea71ebe481aa43b29b8bb1f57bfc75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const COMMIT_ID_LENGTH = 40;
const DEFAULT_COMMIT_ID = Array(COMMIT_ID_LENGTH)
  .fill('0')
  .join('');

export const createCommitId = (index = 0) =>
  `${index}${DEFAULT_COMMIT_ID}`.substr(0, COMMIT_ID_LENGTH);

export const createCommitIdGenerator = () => {
  let prevCommitId = 0;

  const next = () => {
    prevCommitId += 1;

    return createCommitId(prevCommitId);
  };

  return {
    next,
  };
};