diff options
| author | Shinigami <[email protected]> | 2023-02-23 00:59:29 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-22 23:59:29 +0000 |
| commit | aa3e771dbef3d17cd90d9b8941cb091136087ed1 (patch) | |
| tree | a9a501aa766fb80652df5db85476d510a40db3eb /test/git.spec.ts | |
| parent | 25bd847545acb13291ac0a3704688793ca9a0933 (diff) | |
| download | faker-aa3e771dbef3d17cd90d9b8941cb091136087ed1.tar.xz faker-aa3e771dbef3d17cd90d9b8941cb091136087ed1.zip | |
refactor(git): length for commit sha (#1863)
Diffstat (limited to 'test/git.spec.ts')
| -rw-r--r-- | test/git.spec.ts | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/test/git.spec.ts b/test/git.spec.ts index a69b1baa..88c864ee 100644 --- a/test/git.spec.ts +++ b/test/git.spec.ts @@ -13,7 +13,15 @@ describe('git', () => { }); seededTests(faker, 'git', (t) => { - t.itEach('branch', 'commitMessage', 'commitSha', 'shortSha'); + t.itEach('branch', 'commitMessage'); + + t.describe('commitSha', (t) => { + t.it('noArgs') + .it('with length 7', { length: 7 }) + .it('with length 8', { length: 8 }); + }); + + t.skip('shortSha'); t.describeEach( 'commitEntry', @@ -122,7 +130,7 @@ describe('git', () => { }); describe('commitSha', () => { - it('should return a random commitSha', () => { + it('should return a random full commitSha', () => { const commitSha = faker.git.commitSha(); expect(commitSha).toBeTruthy(); @@ -130,17 +138,21 @@ describe('git', () => { expect(commitSha).toSatisfy(validator.isHexadecimal); expect(commitSha).toHaveLength(40); }); - }); - describe('shortSha', () => { - it('should return a random shortSha', () => { - const shortSha = faker.git.shortSha(); - - expect(shortSha).toBeTruthy(); - expect(shortSha).toBeTypeOf('string'); - expect(shortSha).toSatisfy(validator.isHexadecimal); - expect(shortSha).toHaveLength(7); - }); + it.each([ + ['GitHub', 7], + ['GitLab', 8], + ])( + 'should return a random short commitSha for %s', + (_provider, length) => { + const commitSha = faker.git.commitSha({ length }); + + expect(commitSha).toBeTruthy(); + expect(commitSha).toBeTypeOf('string'); + expect(commitSha).toSatisfy(validator.isHexadecimal); + expect(commitSha).toHaveLength(length); + } + ); }); } }); |
