Skip to content
Snippets Groups Projects
Select Git revision
  • 7afc2b75d5a7396ae130359f05722210d7de146d
  • main default protected
  • renovate/main-ghcr.io-renovatebot-base-image-11.x
  • renovate/main-renovatebot-detect-tools-1.x
  • refactor/pin-new-value
  • fix/user-agent
  • feat/37517-base64-private-key
  • next
  • feat/gnupg
  • fix/36615b-branch-reuse-no-cache
  • chore/punycode
  • feat/36219--git-x509-signing
  • feat/structured-logger
  • hotfix/39.264.1
  • feat/skip-dangling
  • gh-readonly-queue/next/pr-36034-7a061c4ca1024a19e2c295d773d9642625d1c2be
  • hotfix/39.238.3
  • refactor/gitlab-auto-approve
  • feat/template-strings
  • gh-readonly-queue/next/pr-35654-137d934242c784e0c45d4b957362214f0eade1d7
  • fix/32307-global-extends-merging
  • 41.116.6
  • 41.116.5
  • 41.116.4
  • 41.116.3
  • 41.116.2
  • 41.116.1
  • 41.116.0
  • 41.115.6
  • 41.115.5
  • 41.115.4
  • 41.115.3
  • 41.115.2
  • 41.115.1
  • 41.115.0
  • 41.114.0
  • 41.113.8
  • 41.113.7
  • 41.113.6
  • 41.113.5
  • 41.113.4
41 results

author.spec.ts

Blame
  • author.spec.ts 1.41 KiB
    import { parseGitAuthor } from './author';
    
    describe('util/git/author', () => {
      describe('parseGitAuthor', () => {
        it('returns null if empty email given', () => {
          expect(parseGitAuthor(undefined)).toBeNull();
        });
        it('handles a normal address', () => {
          expect(parseGitAuthor('renovate@whitesourcesoftware.com')).not.toBeNull();
        });
        it('parses bot email', () => {
          // FIXME: explicit assert condition
          expect(parseGitAuthor('renovate[bot]@users.noreply.github.com'))
            .toMatchInlineSnapshot(`
            Object {
              "address": "renovate[bot]@users.noreply.github.com",
              "name": "renovate[bot]",
            }
          `);
        });
        it('parses bot name and email', () => {
          // FIXME: explicit assert condition
          expect(
            parseGitAuthor('renovate[bot] <renovate[bot]@users.noreply.github.com>')
          ).toMatchInlineSnapshot(`
            Object {
              "address": "renovate[bot]@users.noreply.github.com",
              "name": "renovate[bot]",
            }
          `);
        });
        it('escapes names', () => {
          // FIXME: explicit assert condition
          expect(
            parseGitAuthor('name [what] <name@what.com>').name
          ).toMatchInlineSnapshot(`"name [what]"`);
        });
        it('tries again and fails', () => {
          expect(parseGitAuthor('foo<foo>')).toBeNull();
        });
        it('gives up', () => {
          expect(parseGitAuthor('a.b.c')).toBeNull();
        });
      });
    });