Skip to content
Snippets Groups Projects
Select Git revision
  • 4d55e8f433d90b269c80de7e6831f0941464df81
  • actions/playwright-image-updates
  • langleyd/memberlist_to_virtuoso
  • develop
  • rav/matrixchat_test_fixes
  • florianduros/audio-components
  • backport-30408-to-staging
  • rav/reenable_matrixchat_test
  • renovate/vector-im
  • actions/localazy-download
  • robin/notification-capability
  • t3chguy/module-api-1.3.0
  • midhun/mvvm/state-management-1
  • renovate/major-eslint
  • renovate/browserslist
  • renovate/eslint
  • renovate/css
  • renovate/filesize-11.x
  • staging
  • hs/refactor-invite-dialog-federate
  • hs/fix-via-in-test
  • v1.11.107-rc.0
  • v1.11.106
  • v1.11.106-rc.0
  • v1.11.105
  • v1.11.105-rc.0
  • v1.11.104
  • v1.11.104-rc.0
  • v1.11.103
  • v1.11.102
  • v1.11.102-rc.0
  • v1.11.101
  • v1.11.101-rc.0
  • v1.11.100
  • v1.11.100-rc.0
  • v1.11.99
  • v1.11.98
  • v1.11.98-rc.0
  • v1.11.97
  • v1.11.97-rc.0
  • v1.11.96
41 results

webpack.config.js

Blame
  • utils.spec.ts 1.88 KiB
    import { partial } from '../../../../test/util';
    import { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages';
    import type { Repo } from './types';
    import { getMergeMethod, getRepoUrl, trimTrailingApiPath } from './utils';
    
    describe('modules/platform/gitea/utils', () => {
      const mockRepo = partial<Repo>({
        allow_rebase: true,
        clone_url: 'https://gitea.renovatebot.com/some/repo.git',
        ssh_url: 'git@gitea.renovatebot.com/some/repo.git',
        default_branch: 'master',
        full_name: 'some/repo',
        permissions: {
          pull: true,
          push: true,
          admin: false,
        },
      });
    
      it('trimTrailingApiPath', () => {
        expect(trimTrailingApiPath('https://gitea.renovatebot.com/api/v1')).toBe(
          'https://gitea.renovatebot.com/'
        );
        expect(trimTrailingApiPath('https://gitea.renovatebot.com/api/v1/')).toBe(
          'https://gitea.renovatebot.com/'
        );
        expect(trimTrailingApiPath('https://gitea.renovatebot.com/')).toBe(
          'https://gitea.renovatebot.com/'
        );
        expect(trimTrailingApiPath('https://gitea.renovatebot.com')).toBe(
          'https://gitea.renovatebot.com'
        );
        expect(
          trimTrailingApiPath('https://gitea.renovatebot.com/api/gitea/api/v1')
        ).toBe('https://gitea.renovatebot.com/api/gitea/');
      });
    
      describe('getRepoUrl', () => {
        it('should abort when endpoint is not valid', () => {
          expect.assertions(1);
          expect(() => getRepoUrl(mockRepo, 'endpoint', 'abc')).toThrow(
            CONFIG_GIT_URL_UNAVAILABLE
          );
        });
      });
    
      it.each`
        value             | expected
        ${'auto'}         | ${null}
        ${undefined}      | ${null}
        ${'fast-forward'} | ${'rebase'}
        ${'merge-commit'} | ${'merge'}
        ${'rebase'}       | ${'rebase-merge'}
        ${'squash'}       | ${'squash'}
      `('getMergeMethod("$value") == "$expected"', ({ value, expected }) => {
        expect(getMergeMethod(value)).toBe(expected);
      });
    });