- (feat) add 'key as default value' post processor (closes #109) - (chore) move clean functionality to a post processor - (chore) move sort functionality to a post processor - (refactor) get rid of leading underscore on protected properties/methods
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { expect } from 'chai';
 | |
| 
 | |
| import { PostProcessorInterface } from '../../src/post-processors/post-processor.interface';
 | |
| import { KeyAsDefaultValuePostProcessor } from '../../src/post-processors/key-as-default-value.post-processor';
 | |
| import { TranslationCollection } from '../../src/utils/translation.collection';
 | |
| 
 | |
| describe('KeyAsDefaultValuePostProcessor', () => {
 | |
| 
 | |
| 	let processor: PostProcessorInterface;
 | |
| 
 | |
| 	beforeEach(() => {
 | |
| 		processor = new KeyAsDefaultValuePostProcessor();
 | |
| 	});
 | |
| 
 | |
| 	it('should use key as default value', () => {
 | |
| 		const collection = new TranslationCollection({
 | |
| 			'I have no value': '',
 | |
| 			'I am already translated': 'Jeg er allerede oversat',
 | |
| 			'Use this key as value as well': ''
 | |
| 		});
 | |
| 		const extracted = new TranslationCollection();
 | |
| 		const existing = new TranslationCollection();
 | |
| 
 | |
| 		expect(processor.process(collection, extracted, existing).values).to.deep.equal({
 | |
| 			'I have no value': 'I have no value',
 | |
| 			'I am already translated': 'Jeg er allerede oversat',
 | |
| 			'Use this key as value as well': 'Use this key as value as well'
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| });
 |