-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonnie Spratley
committed
Apr 2, 2014
1 parent
42f4ebd
commit 067cab5
Showing
6 changed files
with
246 additions
and
114 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
#Routes Spec | ||
request = require("request") | ||
|
||
describe 'Testing api endpoint', () -> | ||
it "should respond with hello world", (done) -> | ||
jsonResponse = { message: ' REST API Server v2' } | ||
request "http://localhost:8181/api/v2", (error, response, body) -> | ||
expect(JSON.prase(response.body)).toEqual jsonResponse | ||
endpoint = 'http://localhost:8181/api/v2' | ||
|
||
describe 'Testing: API Server', () -> | ||
it "GET - /api/v2 - should respond with REST API Server v2", (done) -> | ||
jsonResponse = { message: 'REST API Server v2' } | ||
request endpoint, (error, response, body) -> | ||
expect(JSON.parse(response.body)).toEqual jsonResponse | ||
done() | ||
|
||
it "GET - /angular-cms/users - should return a list of users", (done) -> | ||
request "#{endpoint}/angular-cms/users", (error, response, body) -> | ||
expect(JSON.parse(response.body).length).toBeGreaterThan 0 | ||
done() | ||
|
||
it "POST - /angular-cms/users - should create and return object", (done) -> | ||
postData = | ||
"username": "nodetest", | ||
"email": "[email protected]", | ||
"password": "test", | ||
"active": true, | ||
"groups": ["member"], | ||
"_activation": "", | ||
"_key": "", | ||
"created": new Date(), | ||
"modified": new Date(), | ||
"metadata": {"avatar": "", "name": "Node Test User"} | ||
|
||
options = | ||
uri: "#{endpoint}/angular-cms/users" | ||
method: 'POST' | ||
json: postData | ||
request options, (error, response, body) -> | ||
console.log(body) | ||
expect(response.status).toBe 'ok' | ||
done() | ||
|