mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(columns) add name-size (#139)
This commit is contained in:
parent
22142e00ba
commit
b232a936fb
8 changed files with 52 additions and 6 deletions
|
|
@ -6,18 +6,29 @@ const clean = require('clear-module');
|
|||
const columnsPath = '../../server/columns';
|
||||
|
||||
test('columns', (t) => {
|
||||
clean(columnsPath);
|
||||
|
||||
const {NODE_ENV} = process.env;
|
||||
process.env.NODE_ENV = '';
|
||||
const columns = require(columnsPath);
|
||||
|
||||
t.equal(columns[''], '', 'should equal');
|
||||
process.env.NODE_ENV = NODE_ENV;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('columns: dev', (t) => {
|
||||
clean(columnsPath);
|
||||
process.NODE_ENV = 'development';
|
||||
const {NODE_ENV} = process.env;
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
const columns = require(columnsPath);
|
||||
const css = fs.readFileSync(`${__dirname}/../../css/columns/name-size-date.css`, 'utf8');
|
||||
|
||||
t.equal(columns['name-size-date'], css, 'should equal');
|
||||
process.env.NODE_ENV = NODE_ENV;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const dir = '../..';
|
|||
|
||||
const validatePath = `${dir}/server/validate`;
|
||||
const exitPath = `${dir}/server/exit`;
|
||||
const columnsPath = `${dir}/server/columns`;
|
||||
|
||||
const validate = require(validatePath);
|
||||
const stub = require('mock-require');
|
||||
|
|
@ -126,11 +127,16 @@ test('validate: columns: wrong', (t) => {
|
|||
const fn = sinon.stub();
|
||||
|
||||
clean();
|
||||
clear(columnsPath);
|
||||
require(exitPath);
|
||||
stub(exitPath, fn);
|
||||
stub(columnsPath, {
|
||||
'name-size-date': '',
|
||||
'name-size': '',
|
||||
});
|
||||
|
||||
const {columns} = require(validatePath);
|
||||
const msg = 'cloudcmd --columns: could be "name-size-date" or "name-size-date-owner-mode"';
|
||||
const msg = 'cloudcmd --columns: can be only one of: "name-size-date", "name-size"';
|
||||
|
||||
columns('hello');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue