mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(route) getIndexPath
This commit is contained in:
parent
1005690acb
commit
e3e9e92b44
2 changed files with 25 additions and 5 deletions
|
|
@ -164,14 +164,15 @@ test('cloudcmd: route: keys panel', (t) => {
|
|||
});
|
||||
|
||||
test('cloudcmd: route: no index', (t) => {
|
||||
const name = path.join(__dirname, '../../dist-dev/index.html');
|
||||
const nameAfter = path.join(__dirname, '../../dist-dev/index1.html');
|
||||
const name = path.join(__dirname, '../../dist/index.html');
|
||||
const nameAfter = path.join(__dirname, '../../dist/index1.html');
|
||||
|
||||
fs.renameSync(name, nameAfter);
|
||||
|
||||
before({}, (port, after) => {
|
||||
getStr(`http://localhost:${port}/`)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
fs.renameSync(nameAfter, name);
|
||||
t.equal(result.indexOf('ENOENT'), 0, 'should not found index.html');
|
||||
t.end();
|
||||
|
|
@ -180,6 +181,22 @@ test('cloudcmd: route: no index', (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test('cloudcmd: route: getIndexPath: production', (t) => {
|
||||
const isDev = false;
|
||||
const name = path.join(__dirname, '..', '..', 'dist', 'index.html');
|
||||
|
||||
t.equal(route._getIndexPath(isDev), name);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: route: getIndexPath: development', (t) => {
|
||||
const isDev = true;
|
||||
const name = path.join(__dirname, '..', '..', 'dist-dev', 'index.html');
|
||||
|
||||
t.equal(route._getIndexPath(isDev), name);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: route: file', (t) => {
|
||||
const root = path.join(__dirname, '..', 'fixture', 'empty-file');
|
||||
const config = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue