Skip to content

Commit

Permalink
Added a testcase for clearAll (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenaaron3 committed May 21, 2020
1 parent 29fe40b commit 45b51ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/specs/cache.js
Expand Up @@ -171,6 +171,16 @@ describe( 'flat-cache', function () {
expect( fs.existsSync( path.resolve( __dirname, '../fixtures/.cache2/someId' ) ) ).to.be.false;
} );

it( 'should remove the cache directory from disk using flatCache.clearAll', function () {
var cache1 = flatCache.load( 'someId', path.resolve( __dirname, '../fixtures/.cache2' ) );
var cache2 = flatCache.load( 'someOtherId', path.resolve( __dirname, '../fixtures/.cache2' ) );
cache1.save();
cache2.save();
expect( fs.existsSync( path.resolve( __dirname, '../fixtures/.cache2/someId' ) ) ).to.be.true;
expect( fs.existsSync( path.resolve( __dirname, '../fixtures/.cache2/someOtherId' ) ) ).to.be.true;
flatCache.clearAll( path.resolve( __dirname, '../fixtures/.cache2' ) )
expect( fs.existsSync( path.resolve( __dirname, '../fixtures/.cache2' ) ) ).to.be.false;
} );
} );

describe( 'loading a cache using a filePath directly', function () {
Expand Down

0 comments on commit 45b51ca

Please sign in to comment.