mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(package) flop v8.0.0
This commit is contained in:
parent
901fd252f1
commit
fe163ef5fb
3 changed files with 10 additions and 12 deletions
|
|
@ -125,7 +125,7 @@
|
|||
"express": "^4.13.0",
|
||||
"files-io": "^3.0.0",
|
||||
"find-up": "^4.0.0",
|
||||
"flop": "^7.0.0",
|
||||
"flop": "^8.0.0",
|
||||
"for-each-key": "^2.0.0",
|
||||
"format-io": "^2.0.0",
|
||||
"fullstore": "^2.0.2",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const DIR_COMMON = '../common/';
|
|||
const {realpath} = require('fs').promises;
|
||||
const {promisify} = require('util');
|
||||
|
||||
const flop = require('flop');
|
||||
const {read} = require('flop');
|
||||
const ponse = require('ponse');
|
||||
const rendy = require('rendy');
|
||||
const format = require('format-io');
|
||||
|
|
@ -36,12 +36,10 @@ const {FS} = CloudFunc;
|
|||
const Columns = require(`${DIR_SERVER}/columns`);
|
||||
const Template = require(`${DIR_SERVER}/template`);
|
||||
|
||||
const flopRead = promisify(flop.read);
|
||||
|
||||
const tokenize = (fn, a) => (b) => fn(a, b);
|
||||
const getReadDir = (config) => {
|
||||
if (!config('dropbox'))
|
||||
return flopRead;
|
||||
return read;
|
||||
|
||||
const {readDir} = onceRequire('@cloudcmd/dropbox');
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const fs = require('fs');
|
|||
const tryToCatch = require('try-to-catch');
|
||||
const test = require('supertape');
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire} = mockRequire;
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const fixtureDir = path.join(__dirname, '..', 'test', 'fixture');
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ test('cloudcmd: route: sendIndex: encode', async (t) => {
|
|||
name,
|
||||
}];
|
||||
|
||||
const read = (path, fn) => fn(null, {
|
||||
const read = async (path) => ({
|
||||
path,
|
||||
files,
|
||||
});
|
||||
|
|
@ -277,7 +277,7 @@ test('cloudcmd: route: sendIndex: encode', async (t) => {
|
|||
|
||||
const {body} = await request.get('/');
|
||||
|
||||
mockRequire.stop('flop');
|
||||
stopAll();
|
||||
|
||||
t.ok(body.includes(nameEncoded), 'should encode name');
|
||||
t.end();
|
||||
|
|
@ -289,7 +289,7 @@ test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
|
|||
name,
|
||||
}];
|
||||
|
||||
const read = (path, fn) => fn(null, {
|
||||
const read = async (path) => ({
|
||||
path,
|
||||
files,
|
||||
});
|
||||
|
|
@ -304,7 +304,7 @@ test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
|
|||
const {request} = serveOnce(cloudcmd);
|
||||
const {body} = await request.get('/');
|
||||
|
||||
mockRequire.stop('flop');
|
||||
stopAll();
|
||||
|
||||
t.notOk(body.includes(name), 'should not put not encoded name');
|
||||
t.end();
|
||||
|
|
@ -316,7 +316,7 @@ test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
|
|||
name,
|
||||
}];
|
||||
|
||||
const read = (path, fn) => fn(null, {
|
||||
const read = async (path) => ({
|
||||
path,
|
||||
files,
|
||||
});
|
||||
|
|
@ -334,7 +334,7 @@ test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
|
|||
|
||||
const {status} = await request.get('/');
|
||||
|
||||
mockRequire.stop('flop');
|
||||
stopAll();
|
||||
|
||||
t.equal(status, 200, 'should not hang up');
|
||||
t.end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue