Update AllCombinationsOfSizeK.js (#1530)

* Update AllCombinationsOfSizeK.js

* Update AllCombinationsOfSizeK.js

* Update AllCombinationsOfSizeK.test.js

Changes made it the type of testing. 
Instead of testing the class now the program will test the function

* Update AllCombinationsOfSizeK.js

* Update AllCombinationsOfSizeK.js

* Update AllCombinationsOfSizeK.js

* Update AllCombinationsOfSizeK.test.js

* Update AllCombinationsOfSizeK.test.js
This commit is contained in:
Rahul Bhandari
2023-10-30 11:10:02 +05:30
committed by GitHub
parent 1cc5e61ff0
commit cafb3433e8
2 changed files with 28 additions and 46 deletions

View File

@ -1,9 +1,9 @@
import { Combinations } from '../AllCombinationsOfSizeK'
import { generateCombinations } from '../AllCombinationsOfSizeK'
describe('AllCombinationsOfSizeK', () => {
it('should return 3x2 matrix solution for n = 3 and k = 2', () => {
const test1 = new Combinations(3, 2)
expect(test1.findCombinations()).toEqual([
const res = generateCombinations(3, 2)
expect(res).toEqual([
[1, 2],
[1, 3],
[2, 3]
@ -11,8 +11,8 @@ describe('AllCombinationsOfSizeK', () => {
})
it('should return 6x2 matrix solution for n = 4 and k = 2', () => {
const test2 = new Combinations(4, 2)
expect(test2.findCombinations()).toEqual([
const res = generateCombinations(4, 2)
expect(res).toEqual([
[1, 2],
[1, 3],
[1, 4],