Skip to content

Commit 7869e81

Browse files
committed
test(ngx-combination-generator): added test for unique parameter to load the combinations
1 parent a4e5867 commit 7869e81

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/module/service/ngx-combination-generator.service.spec.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

55
describe('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

Comments
 (0)