apify-test-tools 0.8.1-beta.0 → 0.8.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify-test-tools",
3
- "version": "0.8.1-beta.0",
3
+ "version": "0.8.1-beta.2",
4
4
  "type": "module",
5
5
  "description": "TBD",
6
6
  "repository": {
@@ -63,6 +63,18 @@ describe('getCommits', () => {
63
63
  );
64
64
  });
65
65
 
66
+ it('should ignore the base commit and return all commits when it is the branch HEAD (rerun or force push)', () => {
67
+ // Act
68
+ const commits = getCommits({ sourceBranch, targetBranch, baseCommit: sha3 });
69
+
70
+ // Assert
71
+ expect(commits).toStrictEqual([
72
+ { sha: sha1, author: 'Author1', date: 'Date1', message: 'First Change On Feature' },
73
+ { sha: sha2, author: 'Author1', date: 'Date2', message: 'Second Change On Feature' },
74
+ { sha: sha3, author: 'Author1', date: 'Date3', message: 'Third Change On Feature' },
75
+ ]);
76
+ });
77
+
66
78
  it('should return all commits if base commit is not found', () => {
67
79
  // Act
68
80
  const commits = getCommits({ sourceBranch, targetBranch, baseCommit: 'a'.repeat(40) });
@@ -107,6 +119,12 @@ describe('getChangedFiles', () => {
107
119
  expect(gitCommandSpy).toHaveBeenCalledWith(`git diff --name-only ${firstSha}~..${lastSha}`);
108
120
  });
109
121
 
122
+ it('should throw without running git when the commit list is empty', () => {
123
+ // Act & Assert
124
+ expect(() => getChangedFiles([])).toThrow('Cannot get changed files: the commit list is empty');
125
+ expect(gitCommandSpy).not.toHaveBeenCalled();
126
+ });
127
+
110
128
  it('should handle only one commit', () => {
111
129
  // Arrange
112
130
  const onlySha = '1'.repeat(40);