mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
test(cloudcmd) sw
This commit is contained in:
parent
0323dd3a91
commit
accdcc885d
1 changed files with 17 additions and 1 deletions
|
|
@ -7,18 +7,24 @@ const diff = require('sinon-called-with-diff');
|
|||
const sinon = diff(require('sinon'));
|
||||
const currify = require('currify');
|
||||
const clean = require('clear-module');
|
||||
const request = require('request');
|
||||
const {promisify} = require('es6-promisify');
|
||||
|
||||
const DIR = '../../server/';
|
||||
const cloudcmdPath = DIR + 'cloudcmd';
|
||||
const beforePath = '../before';
|
||||
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const config = require(DIR + 'config');
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const {connect} = require(beforePath);
|
||||
const {
|
||||
_getPrefix,
|
||||
_auth,
|
||||
_replacePrefix,
|
||||
} = cloudcmd;
|
||||
|
||||
const get = promisify(request);
|
||||
|
||||
test('cloudcmd: args: no', (t) => {
|
||||
const fn = () => cloudcmd();
|
||||
|
||||
|
|
@ -219,6 +225,16 @@ test('cloudcmd: getIndexPath: development', (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: sw', async (t) => {
|
||||
const {port, done} = await connect();
|
||||
const {statusCode}= await get(`http://localhost:${port}/sw.js`);
|
||||
done();
|
||||
|
||||
t.equal(statusCode, 200, 'should return sw');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
function cleanNodeEnv() {
|
||||
const {NODE_ENV} = process.env;
|
||||
process.env.NODE_ENV = '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue