mirror of
https://github.com/harish2704/npm-offline-registry.git
synced 2026-09-10 06:21:09 +00:00
More advanced features.
* fetch data from main registry if cache look up is failed * save fetched data to npm's cache, in same was as npm does the job
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/* globals describe, it */
|
||||
|
||||
var utils = require( '../utils' );
|
||||
var assert = require('assert');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
|
||||
var fetchAndCacheMetadata = utils.fetchAndCacheMetadata;
|
||||
var fetchAndCacheTarball = utils.fetchAndCacheTarball;
|
||||
|
||||
/* TODO: write test */
|
||||
// var patchData = utils.patchData;
|
||||
|
||||
|
||||
describe( 'Utility functions ', function(){
|
||||
|
||||
it.skip( 'should fetchAndCacheMetadata', function( ){
|
||||
var cacheFile = '/home/hari/.npm/registry.npmjs.org/lodash/.cache.json';
|
||||
fetchAndCacheMetadata( 'lodash', cacheFile );
|
||||
assert( fs.existsSync( cacheFile ) );
|
||||
});
|
||||
|
||||
it( 'should fetchAndCacheTarball', function(){
|
||||
var cacheFile = '/home/hari/.npm/lodash/4.2.1/package.tgz';
|
||||
var packageJsonFile = path.dirname( cacheFile ) + '/package/package.json';
|
||||
|
||||
fetchAndCacheTarball( 'lodash', '4.2.1', cacheFile );
|
||||
assert( fs.existsSync( cacheFile ) );
|
||||
assert( fs.existsSync( packageJsonFile ) );
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user