Skip to content

Commit

Permalink
Fix formatting and add circle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zootalures committed Mar 22, 2018
1 parent 9d4ee6a commit f8cefcd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
15 changes: 4 additions & 11 deletions .circleci/config.yml
Expand Up @@ -11,18 +11,11 @@ jobs:
command: |
node --version
npm --version
# - run:
# name: "Upgrading node"
# command: |
# curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
# sudo apt-get install -y nodejs
- checkout
# install node
# - run: |
# curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
# sudo apt-get install -y nodejs
# - run: node -v

- run:
name: "test"
command: |
./test.sh
# TODO: run npm test
- deploy:
command: |
Expand Down
6 changes: 3 additions & 3 deletions fn-fdk.js
Expand Up @@ -151,7 +151,7 @@ function convertResult (result, contextout) {

function buildJSONResponse (result, contextout, protoout) {
let body = result !== null ? JSON.stringify(result) : ''

return JSON.stringify(
{
body: body,
Expand All @@ -160,7 +160,7 @@ function buildJSONResponse (result, contextout, protoout) {
status_code: protoout.status_code,
headers: protoout.headers
}
})+ "\n"
}) + '\n'
}

function buildJSONError () {
Expand All @@ -171,5 +171,5 @@ function buildJSONError () {
protocol: {
status_code: 500
}
})+ "\n"
}) + '\n'
}
14 changes: 7 additions & 7 deletions func.js
Expand Up @@ -2,11 +2,11 @@

const fdk = require('./fn-fdk.js')

fdk.handle(function(input, ctx) {
var name = 'World';
if (input.name) {
name = input.name;
}
response = {'message': 'Hello ' + name}
return response
fdk.handle(function (input, ctx) {
let name = 'World'
if (input.name) {
name = input.name
}
let response = {'message': 'Hello ' + name}
return response
})
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions release.sh
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
set -ex

# ensure working dir is clean
Expand Down
5 changes: 5 additions & 0 deletions test.sh
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -ex

docker run --rm -it -v $PWD:/mypkg -w /mypkg node:9-alpine npm install
docker run --rm -it -v $PWD:/mypkg -w /mypkg node:9-alpine npm run test

0 comments on commit f8cefcd

Please sign in to comment.