From 19e7be742212ce40c7f01f0f845ce61871c16768 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 5 Sep 2014 16:54:41 +0100 Subject: [PATCH] add functional test suite --- package.json | 4 +++- test/ciao.json | 11 +++++++++++ test/ciao/index.coffee | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/ciao.json create mode 100644 test/ciao/index.coffee diff --git a/package.json b/package.json index 7ebad061..f305b6e9 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "main": "index.js", "scripts": { "start": "node index.js", - "test": "echo \"Error: no test specified\" && exit 0" + "test": "echo \"Error: no test specified\" && exit 0", + "ciao": "node node_modules/ciao/bin/ciao -c test/ciao.json test/ciao" }, "repository": { "type": "git", @@ -28,6 +29,7 @@ "elasticsearch": ">=1.2.1" }, "dependencies": { + "ciao": "^0.3.4", "express": "^4.8.8" } } diff --git a/test/ciao.json b/test/ciao.json new file mode 100644 index 00000000..11b7e0c9 --- /dev/null +++ b/test/ciao.json @@ -0,0 +1,11 @@ +{ + "defaults": { + "protocol": "http", + "host": "localhost", + "port": 3100, + "headers": { + "User-Agent": "Ciao/Client 1.0" + } + }, + "config": {} +} \ No newline at end of file diff --git a/test/ciao/index.coffee b/test/ciao/index.coffee new file mode 100644 index 00000000..960f6551 --- /dev/null +++ b/test/ciao/index.coffee @@ -0,0 +1,17 @@ + +#> api root +path: '/' + +#? endpoint available +response.statusCode.should.equal 200 + +#? content-type header correctly set +response.should.have.header 'Content-Type','application/json; charset=utf-8' + +#? cache-control header correctly set +response.should.have.header 'Cache-Control','public,max-age=60' + +#? should respond in json with server info +should.exist json +should.exist json.name +should.exist json.version \ No newline at end of file