mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 20:21:47 +01:00 
			
		
		
		
	1. Ignore empty inputs in `UnmarshalHandleDoubleEncode` 2. Ignore non-existing `stateEvent.User` in gitlab migration 3. Enable `release` and `wiki` units when they are selected in migration 4. Sanitize repo name for migration and new repo
		
			
				
	
	
		
			23 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {sanitizeRepoName, substituteRepoOpenWithUrl} from './repo-common.ts';
 | |
| 
 | |
| test('substituteRepoOpenWithUrl', () => {
 | |
|   // For example: "x-github-client://openRepo/https://github.com/go-gitea/gitea"
 | |
|   expect(substituteRepoOpenWithUrl('proto://a/{url}', 'https://gitea')).toEqual('proto://a/https://gitea');
 | |
|   expect(substituteRepoOpenWithUrl('proto://a?link={url}', 'https://gitea')).toEqual('proto://a?link=https%3A%2F%2Fgitea');
 | |
| });
 | |
| 
 | |
| test('sanitizeRepoName', () => {
 | |
|   expect(sanitizeRepoName(' a b ')).toEqual('a-b');
 | |
|   expect(sanitizeRepoName('a-b_c.git ')).toEqual('a-b_c');
 | |
|   expect(sanitizeRepoName('/x.git/')).toEqual('-x.git-');
 | |
|   expect(sanitizeRepoName('.profile')).toEqual('.profile');
 | |
|   expect(sanitizeRepoName('.profile.')).toEqual('.profile');
 | |
|   expect(sanitizeRepoName('.pro..file')).toEqual('.pro.file');
 | |
| 
 | |
|   expect(sanitizeRepoName('foo.rss.atom.git.wiki')).toEqual('foo');
 | |
| 
 | |
|   expect(sanitizeRepoName('.')).toEqual('');
 | |
|   expect(sanitizeRepoName('..')).toEqual('');
 | |
|   expect(sanitizeRepoName('-')).toEqual('');
 | |
| });
 |