From c78bb32f031ab498962e818801dcab835b2aca6f Mon Sep 17 00:00:00 2001 From: ayc Date: Thu, 24 Mar 2016 19:57:50 -0400 Subject: [PATCH 1/3] needs more travis --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8d8f05a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +sudo: false +before_script: + - npm install + - npm install -g mocha +node_js: 4 +script: + - mocha test \ No newline at end of file From 9ef630edcbb6c477f724910ff9c012c3911b23fe Mon Sep 17 00:00:00 2001 From: ayc Date: Thu, 24 Mar 2016 20:05:16 -0400 Subject: [PATCH 2/3] add test documentation on README --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ab7901..380b786 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# leftpad-sdk +# leftpad-sdk [![Build Status](https://travis-ci.org/ayc/leftpad-sdk.svg?branch=master)](https://travis-ci.org/ayc/leftpad-sdk) We were all saddened and shocked by the sudden disappearance of the `left-pad` NPM module. We were lost and unable to left-pad our strings, until one adventurous person decided to develop a RESTful API to offer that same functionality under a revolutionary new technology called SMaaS (String Manipulation as a Service). Believe you me, this is going to be bigger than The Cloud. You can read more about it on its site: http://left-pad.io/ @@ -24,4 +24,16 @@ promise.then(function(ret) { console.log(ret.body.str) }) ``` similarly to the previous example, this will print `#########hello world`. +### Testing + +Tests are handled by [mochajs](http://mochajs.org/). To install with npm: +``` +npm install -g mocha +``` + +To run tests simply: +``` +npm test +``` + That's all. From 16e14f91df4d76d92f0de12dc978d43e30be0fe2 Mon Sep 17 00:00:00 2001 From: ayc Date: Thu, 24 Mar 2016 20:47:31 -0400 Subject: [PATCH 3/3] Needs more Docker --- Dockerfile | 17 +++++++++++++++++ README.md | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2226380 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:4-onbuild + +# Create app directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + + +# Install app dependencies + +# mocha global [todo: do we need this to be global?] +RUN npm install -g mocha + +ONBUILD COPY package.json /usr/src/app/ +ONBUILD RUN npm install +ONBUILD COPY . /usr/src/app + +CMD [ "npm", "test" ] \ No newline at end of file diff --git a/README.md b/README.md index 380b786..c28def7 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,18 @@ To run tests simply: npm test ``` +### Docker + +If you wish to run test without installing anything on your local machine, run it behind a [docker](https://www.docker.com/) container. + +Just build your image +``` +docker build -t leftpad . +``` + +And run it +``` +docker run leftpad +``` + That's all.