1- import { TestBed , inject } from '@angular/core/testing' ;
1+ import { TestBed , inject } from '@angular/core/testing' ;
22
3- import { NgxCombinationGeneratorService } from './ngx-combination-generator.service' ;
3+ import { NgxCombinationGeneratorService } from './ngx-combination-generator.service' ;
44
55describe ( 'LibService' , ( ) => {
66 beforeEach ( ( ) => {
@@ -17,7 +17,22 @@ describe('LibService', () => {
1717 expect ( service . sayHello ( ) ) . toBe ( 'Hello Stanger!' ) ;
1818 } ) ) ;
1919
20- it ( 'should say hello to provided user' , inject ( [ NgxCombinationGeneratorService ] , ( service : NgxCombinationGeneratorService ) => {
20+ it ( 'should say hello to provided user' , inject ( [ NgxCombinationGeneratorService ] , ( service : NgxCombinationGeneratorService ) => {
2121 expect ( service . sayHello ( 'ng-hacker' ) ) . toBe ( 'Hello ng-hacker!' ) ;
2222 } ) ) ;
23+
24+ it ( 'should generate all combinations between two characters' , inject ( [ NgxCombinationGeneratorService ] ,
25+ ( service : NgxCombinationGeneratorService ) => {
26+ const charsList = [ 'a' , 'A' ] ;
27+ const result = service . loadCombinationList ( charsList , 2 , 2 ) ;
28+ expect ( result . length ) . toBe ( 4 ) ;
29+ } ) ) ;
30+
31+ it ( 'should generate all unique combinations between two characters' , inject ( [ NgxCombinationGeneratorService ] ,
32+ ( service : NgxCombinationGeneratorService ) => {
33+ const charsList = [ 'a' , 'A' ] ;
34+ const result = service . loadCombinationList ( charsList , 2 , 2 , true ) ;
35+ expect ( result . length ) . toBe ( 2 ) ;
36+ } ) ) ;
37+
2338} ) ;
0 commit comments