Improve tests.

This commit is contained in:
Franz Diebold 2020-11-30 20:33:02 +01:00
parent 852ab6388c
commit 4454a4b968

View file

@ -19,30 +19,35 @@ test('gets repository owner', () => {
.toEqual('FranzDiebold');
});
test('gets repository owner for empty GITHUB_REPOSITORY', () => {
test('gets repository owner for empty repository', () => {
expect(getRepositoryOwner(undefined)).toBeFalsy();
});
test('gets repository name', () => {
test('gets repository name from repository', () => {
expect(getRepositoryName('FranzDiebold/github-env-vars-action'))
.toEqual('github-env-vars-action');
});
test('gets repository name for empty GITHUB_REPOSITORY', () => {
test('gets repository name for empty repository', () => {
expect(getRepositoryName(undefined)).toBeFalsy();
});
test('gets ref from simple ref name', () => {
test('gets ref name from simple ref', () => {
expect(getRefName('refs/heads/feature-branch-1'))
.toEqual('feature-branch-1');
});
test('gets ref from complex ref name', () => {
test('gets ref name from tag', () => {
expect(getRefName('refs/tags/v1.3.7'))
.toEqual('v1.3.7');
});
test('gets ref name from complex ref', () => {
expect(getRefName('refs/heads/feat/feature-branch-1'))
.toEqual('feat/feature-branch-1');
});
test('gets repository name for empty GITHUB_REF_NAME', () => {
test('gets ref name for empty ref', () => {
expect(getRefName(undefined)).toBeFalsy();
});
@ -51,6 +56,6 @@ test('gets short SHA', () => {
.toEqual('ffac537e');
});
test('gets short SHA for empty GITHUB_SHA', () => {
test('gets short SHA for empty SHA', () => {
expect(getShaShort(undefined)).toBeFalsy();
});