diff --git a/test/index.test.ts b/test/index.test.ts index 89ca4ff..51a837c 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'fs'; import { join } from 'path'; -import { parseBinaryFile, printBinaryFile, printTextFile } from '../src/index'; +import { parseBinaryFile, printBinaryFile, printTextFile, unscramble } from '../src/index'; describe('puz', () => { const puzzleFiles = [ @@ -45,4 +45,12 @@ describe('puz', () => { expect(printTextFile(puzzle)).toMatchSnapshot(); }); }); + + describe('unscramble unlocks puzzle', () => { + const buffer = readFileSync(join(__dirname, 'puzzles', 'nyt_locked.puz')); + const puzzle = parseBinaryFile(buffer); + const unscrambledPuzzle = unscramble(puzzle, '7844'); + expect(unscrambledPuzzle.isScrambled).toBe(false); + expect(unscrambledPuzzle.solution.startsWith('PANDORASBOX')); + }); });