-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import path from 'node:path'; | ||
|
||
import Constants from '../../../src/constants.js'; | ||
import FsPoly from '../../../src/polyfill/fsPoly.js'; | ||
import Zip from '../../../src/types/files/archives/zip.js'; | ||
import FileCache from '../../../src/types/files/fileCache.js'; | ||
import { ChecksumBitmask } from '../../../src/types/files/fileChecksums.js'; | ||
|
||
describe('loadFile', () => { | ||
it('should load after saving', async () => { | ||
const tempCache = await FsPoly.mktemp(path.join(Constants.GLOBAL_TEMP_DIR, 'cache')); | ||
await FileCache.loadFile(tempCache); | ||
|
||
// Compute some values | ||
await FileCache.getOrComputeFile(path.join('test', 'fixtures', 'roms', 'raw', 'fizzbuzz.nes'), ChecksumBitmask.CRC32); | ||
await FileCache.getOrComputeEntries(new Zip(path.join('test', 'fixtures', 'roms', 'zip', 'foobar.zip')), ChecksumBitmask.CRC32); | ||
|
||
await FileCache.save(); | ||
await FileCache.loadFile(tempCache); | ||
}); | ||
}); |