mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			805 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			805 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const { toPlural, toSingular, toInputName } = require('../naming');
 | |
| 
 | |
| describe('Name util', () => {
 | |
|   it('Pluralizes with camelcase', () => {
 | |
|     expect(toPlural('post')).toBe('posts');
 | |
|     expect(toPlural('posts')).toBe('posts');
 | |
|     expect(toPlural('Posts')).toBe('posts');
 | |
|     expect(toPlural('home-page')).toBe('homePages');
 | |
|   });
 | |
| 
 | |
|   it('Casts to singular with camelcase', () => {
 | |
|     expect(toSingular('post')).toBe('post');
 | |
|     expect(toSingular('posts')).toBe('post');
 | |
|     expect(toSingular('Posts')).toBe('post');
 | |
|     expect(toSingular('home-pages')).toBe('homePage');
 | |
|   });
 | |
| 
 | |
|   it('Generates valid input type names', () => {
 | |
|     expect(toInputName('post')).toBe('PostInput');
 | |
|     expect(toInputName('posts')).toBe('PostInput');
 | |
|     expect(toInputName('home-page')).toBe('HomePageInput');
 | |
|   });
 | |
| });
 | 
