Add slug values.

This commit is contained in:
Franz Diebold 2020-07-16 11:13:18 +02:00
parent 0a69a6c512
commit 19929f6cd1
6 changed files with 112 additions and 24 deletions

View file

@ -1,7 +1,19 @@
const {
getRepositoryOwner, getRepositoryName, getRefName, getShaShort,
slugify, getRepositoryOwner, getRepositoryName, getRefName, getShaShort,
} = require('./index');
test('slugifies text', () => {
expect(slugify(' /abc+efg*123/test§xyz ')).toEqual('abc-efg-123-test-xyz');
});
test('slugifies ref name with dash', () => {
expect(slugify('feat/feature-branch-1')).toEqual('feat-feature-branch-1');
});
test('slugifies empty text', () => {
expect(slugify('')).toEqual('');
});
test('gets repository owner', () => {
expect(getRepositoryOwner('FranzDiebold/github-env-vars-action'))
.toEqual('FranzDiebold');