Permalink
Browse files

speed up e2e testing

  • Loading branch information...
gjerokrsteski committed Oct 31, 2018
1 parent 9bc0e68 commit a74ea862601885caec308187dcbfc7305a315747
Showing with 2 additions and 30 deletions.
  1. +1 −1 public/bundle-0.17.0.js
  2. +1 −29 routes/index.js

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,14 +1,8 @@
const crypto = require('crypto')
const express = require('express');
const router = express.Router();
const Promise = require('bluebird');
const error = require('../utils/error');
const fs = Promise.promisifyAll(require('fs'));
const version = require('../package.json').version;
const defaultConfig = require('../package.json').defaultOptions;
const reunite = require('../reunite');
const commandline = Object.assign({}, defaultConfig, require('../commandline'));
const DIR = commandline.dir;

const methods = (methods = ['GET']) => (req, res, next) => {
if (methods.includes(req.method)) {
@@ -47,33 +41,11 @@ router.get('/embed', function(req, res){
router.get('/embed_test', function(req, res) {
res.render('embed_test', {
config_id: (typeof req.param('config_id') !== 'undefined') ? req.param('config_id') : 'Demo',
dom_id: (typeof req.param('dom_id') !== 'undefined') ? req.param('dom_id') : 'regina',
dom_id: (typeof req.param('dom_id') !== 'undefined') ? req.param('dom_id') : 'spa',
no_load_status: (typeof req.param('no_load_status') !== 'undefined') ? req.param('no_load_status') : '0'
});
});

// Custom features for Project FMShop
router.get('/fmshop_embed', function(req, res) {
fs.readdirAsync(DIR)
.then(files => files.find((file) => file.startsWith('bundle') && file.endsWith('.js')))
.then(bundleFileName => {
if (bundleFileName) {
return fs.readFileAsync(DIR + '/' + bundleFileName, 'utf8')
}
else {
return error('Bundle JS file not found at directory');
}
})
.then((bundleFile) => {
//send cache friendly headers
res.header("Content-Type", "application/javascript");
// res.header("ETag", weakETag(bundleFile));
res.header("Connection", "keep-alive");

return res.status(200).end(bundleFile);
})
.catch(() => error('Reading bundle JS file failed'));
});
/**
* @param req
* @param res

0 comments on commit a74ea86

Please sign in to comment.