mirror of
https://github.com/bower/bower.git
synced 2026-01-14 16:57:57 -05:00
Move completion cache results to ~/.bower/cache/__bowercompletion__
for cache-clean command to be able to clean it. __bowercompletion__ to avoid potential naming conflicts.
This commit is contained in:
@@ -26,7 +26,7 @@ var folder = process.platform === 'win32'
|
||||
var config = require('rc') ('bower', {
|
||||
cache : path.join(roaming, folder, 'cache'),
|
||||
links : path.join(roaming, folder, 'links'),
|
||||
completion : path.join(roaming, folder, 'completion'),
|
||||
completion : path.join(roaming, folder, 'cache/__bowercompletion__'),
|
||||
json : 'component.json',
|
||||
endpoint : 'https://bower.herokuapp.com',
|
||||
directory : 'components'
|
||||
|
||||
@@ -5,6 +5,7 @@ var path = require('path');
|
||||
var assert = require('assert');
|
||||
|
||||
var complete = require('../lib/util/completion');
|
||||
var config = require('../lib/core/config');
|
||||
var command = require('../lib/commands/completion');
|
||||
var commands = require('../lib/commands');
|
||||
|
||||
@@ -126,4 +127,33 @@ describe('completion', function () {
|
||||
|
||||
cmd.on('end', done);
|
||||
});
|
||||
|
||||
|
||||
describe('completion cache clean', function() {
|
||||
|
||||
it('caches the result of <endpoint>/packages to ~/.bower/cache/__bowercompletion__', function(done) {
|
||||
complete.log = function() {};
|
||||
|
||||
var cmd = command(['install', 'jquery-'], {
|
||||
COMP_CWORD: '2',
|
||||
COMP_LINE: 'bower install jquery-',
|
||||
COMP_POINT: '14'
|
||||
});
|
||||
|
||||
cmd.on('end', function() {
|
||||
var cache = path.join(config.completion, 'install.json');
|
||||
fs.stat(cache, done);
|
||||
});
|
||||
})
|
||||
|
||||
it('is cleared with cache-clean command', function(done) {
|
||||
commands['cache-clean']().on('end', function() {
|
||||
var cache = path.join(config.completion, 'install.json');
|
||||
fs.stat(cache, function(err) {
|
||||
done(err ? null : new Error('completion results wasn\'t cleaned'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user