Fix naming, add tests #5
					 13 changed files with 46 additions and 26 deletions
				
			
		|  | @ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; | ||||||
| import {AppComponent} from './app.component'; | import {AppComponent} from './app.component'; | ||||||
| import {ConverterRegistryService} from './converter-registry.service'; | import {ConverterRegistryService} from './converter-registry.service'; | ||||||
| import {InputComponentManagerService} from './input-component-manager.service'; | import {InputComponentManagerService} from './input-component-manager.service'; | ||||||
| import {NativeLibraryWrapperService} from './nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from './native-library-wrapper.service'; | ||||||
| import {FormsModule} from '@angular/forms'; | import {FormsModule} from '@angular/forms'; | ||||||
| import {VersionComponent} from './version/version.component'; | import {VersionComponent} from './version/version.component'; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ import {HexToDecConverter} from './converter/hextodecconverter'; | ||||||
| import {HTMLEntitiesDecoder} from './converter/htmlentitiesdecoder'; | import {HTMLEntitiesDecoder} from './converter/htmlentitiesdecoder'; | ||||||
| import {HTMLEntitiesEncoder} from './converter/htmlentitiesencoder'; | import {HTMLEntitiesEncoder} from './converter/htmlentitiesencoder'; | ||||||
| import {Injectable} from '@angular/core'; | import {Injectable} from '@angular/core'; | ||||||
| import {NativeLibraryWrapperService} from './nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from './native-library-wrapper.service'; | ||||||
| import {PunycodeDecoder} from './converter/punycodedecoder'; | import {PunycodeDecoder} from './converter/punycodedecoder'; | ||||||
| import {PunycodeEncoder} from './converter/punycodeencoder'; | import {PunycodeEncoder} from './converter/punycodeencoder'; | ||||||
| import {QuotedPrintableDecoder} from './converter/quotedprintabledecoder'; | import {QuotedPrintableDecoder} from './converter/quotedprintabledecoder'; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class PunycodeDecoder implements Converter { | export class PunycodeDecoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class PunycodeEncoder implements Converter { | export class PunycodeEncoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class QuotedPrintableDecoder implements Converter { | export class QuotedPrintableDecoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class QuotedPrintableEncoder implements Converter { | export class QuotedPrintableEncoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class UTF8Decoder implements Converter { | export class UTF8Decoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import {Converter} from './converter'; | import {Converter} from './converter'; | ||||||
| import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service'; | import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; | ||||||
| 
 | 
 | ||||||
| export class UTF8Encoder implements Converter { | export class UTF8Encoder implements Converter { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								src/app/native-library-wrapper.service.spec.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/app/native-library-wrapper.service.spec.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | import { TestBed, inject } from '@angular/core/testing'; | ||||||
|  | 
 | ||||||
|  | import { NativeLibraryWrapperService } from './native-library-wrapper.service'; | ||||||
|  | 
 | ||||||
|  | describe('NativeLibraryWrapperService', () => { | ||||||
|  |   beforeEach(() => { | ||||||
|  |     TestBed.configureTestingModule({ | ||||||
|  |       providers: [NativeLibraryWrapperService] | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   it('should be created', inject([NativeLibraryWrapperService], (service: NativeLibraryWrapperService) => { | ||||||
|  |     expect(service).toBeTruthy(); | ||||||
|  |   })); | ||||||
|  | }); | ||||||
|  | @ -1,12 +1,11 @@ | ||||||
| import {Injectable} from '@angular/core'; | import {Injectable} from '@angular/core'; | ||||||
| import {Punycode} from './punycode'; |  | ||||||
| import {Utf8} from './utf8'; |  | ||||||
| import {QuotedPrintable} from './quotedprintable'; |  | ||||||
| import * as NativeUtf8 from 'utf8'; |  | ||||||
| import * as NativeQuotedPrintable from 'quoted-printable'; |  | ||||||
| import * as NativePunycode from 'punycode'; | import * as NativePunycode from 'punycode'; | ||||||
|  | import * as NativeQuotedPrintable from 'quoted-printable'; | ||||||
|  | import * as NativeUtf8 from 'utf8'; | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable({ | ||||||
|  |   providedIn: 'root' | ||||||
|  | }) | ||||||
| export class NativeLibraryWrapperService { | export class NativeLibraryWrapperService { | ||||||
|   public utf8: Utf8; |   public utf8: Utf8; | ||||||
|   public quotedPrintable: QuotedPrintable; |   public quotedPrintable: QuotedPrintable; | ||||||
|  | @ -18,3 +17,21 @@ export class NativeLibraryWrapperService { | ||||||
|     this.punycode = NativePunycode; |     this.punycode = NativePunycode; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | interface Punycode { | ||||||
|  |   encode(input: string): string; | ||||||
|  | 
 | ||||||
|  |   decode(input: string): string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | interface QuotedPrintable { | ||||||
|  |   encode(input: string): string; | ||||||
|  | 
 | ||||||
|  |   decode(input: string): string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | interface Utf8 { | ||||||
|  |   encode(input: any): string; | ||||||
|  | 
 | ||||||
|  |   decode(input: string): any; | ||||||
|  | } | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| export interface Punycode { |  | ||||||
|   encode(input: string): string; |  | ||||||
|   decode(input: string): string; |  | ||||||
| } |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| export interface QuotedPrintable { |  | ||||||
|   encode(input: string): string; |  | ||||||
|   decode(input: string): string; |  | ||||||
| } |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| export interface Utf8 { |  | ||||||
|   encode(input: any): string; |  | ||||||
|   decode(input: string): any; |  | ||||||
| } |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue