Skip to content

Commit

Permalink
Added some test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar Shubham committed Jun 22, 2017
1 parent adebe1d commit b52370b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
.git
.gitignore
node_modules
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 1,31 @@
FROM node:boron

RUN useradd -m teemlp

WORKDIR $HOME/app

USER teemlp

COPY package.json $HOME/app

USER root

RUN mkdir -p /home/teemlp/app

RUN chown -R teemlp:teemlp /home/teemlp/app

RUN npm install -g babel-cli

USER teemlp

COPY ./**/*.* /home/teemlp/app/

RUN cd /home/teemlp/app

RUN ls

RUN npm start

EXPOSE 9090


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@
"main": "index.js",
"scripts": {
"test": "mocha",
"start": "npm ./lib/server/server"
"start": "babel src -d lib && node ./lib/server/server"
},
"repository": {
"type": "git",
Expand Down
11 changes: 5 additions & 6 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 14,11 @@ const server = express();
server.use(bodyParser.urlencoded({extended: false}));
server.use(bodyParser.json());

server.all('*', (req,res,next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers','Origin, X-Requested-With, Content-Type, Accept');
next();
});

routes(server);

Expand All @@ -28,9 33,3 @@ server.listen(port, () => {


export default server;






6 changes: 2 additions & 4 deletions test/postFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,8 @@ const port = require('../config.json').port;
chai.use(chaiHttp);


describe('postFetch', () => {
describe('postFetch', function () {
this.timeout(10000);
//change this URL to test for any webpage
const URI_TO_TEST = 'https://krshubham.github.io';
it('should make a post request to the fetch route', (done) => {
Expand Down Expand Up @@ -35,6 36,3 @@ describe('postFetch', () => {
});
});
});



0 comments on commit b52370b

Please sign in to comment.