Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created December 19, 2021 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/17d28f8721f85a356f30157bc8439283 to your computer and use it in GitHub Desktop.
Save YonatanKra/17d28f8721f85a356f30157bc8439283 to your computer and use it in GitHub Desktop.
const sequence = `diamondStep ${[1,2,3,4].reduce((v) => v += 'squareStep ', '')}`
const expectedSequence = `${[1,2,3,4,5].reduce(v => v += sequence, '')}`;
let output = '';
jest.spyOn(diamondSquare, 'diamondStep').mockImplementation(() => {
output += 'diamondStep ';
});
jest.spyOn(diamondSquare, 'squareStep').mockImplementation(() => {
output += 'squareStep ';
});
diamondSquare.createHeightMap(5);
expect(output).toEqual(expectedSequence);
@Dnjdjdb
Copy link

Dnjdjdb commented Jun 9, 2023

18

@mhady55
Copy link

mhady55 commented Sep 11, 2023

10

@mtarc
Copy link

mtarc commented Oct 30, 2023

Com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment