This repository has been archived by the owner on May 3, 2022. It is now read-only.
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
Andrei Neculau
committed
Jul 1, 2013
1 parent
d18578c
commit 98c7f94
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../.coffee.mk/test/_utils.coffee |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
should | ||
} = require './_utils' | ||
format = require('../').format | ||
|
||
describe 'format', () -> | ||
|
||
|
||
describe '.normalizeHeaders', () -> | ||
it 'should lowercase headers', () -> | ||
reqres = {headers: {'Accept': '', 'Content-TyPe': ''}} | ||
format.normalizeHeaders(reqres).should.eql | ||
'accept': '' | ||
'content-type': '' | ||
|
||
|
||
describe '.headers', () -> | ||
it 'should camelize headers', () -> | ||
reqres = {headers: {'accept': '', 'content-TyPe': ''}} | ||
format.headers(reqres).should.eql | ||
'Accept': '' | ||
'Content-Type': '' | ||
|
||
it 'should sort headers', () -> | ||
reqres = {headers: {'Content-Type': '', 'Accept': ''}} | ||
format.headers(reqres).should.eql | ||
'Accept': '' | ||
'Content-Type': '' | ||
|
||
|
||
describe '.json', () -> | ||
it 'should ignore non-JSON Content-Types', () -> | ||
reqres = {headers: {'content-type':'application/xml'}, body:''} | ||
format.json(reqres, null, null, []).should.eql '' | ||
|
||
it 'should return no error on valid JSON', () -> | ||
reqres = {headers:{'content-type':'application/json'}, body:'{}'} | ||
format.json(reqres, null, null, []).should.eql '{}' |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
should | ||
} = require './_utils' | ||
lint = require('../').lint | ||
|
||
describe 'lint', () -> | ||
it 'should return one error of type invalid_blueprint', () -> | ||
lint('')[0].type.should.eql 'invalid_blueprint' | ||
|
||
|
||
describe 'json', () -> | ||
it 'should return one error of type invalid_json', () -> | ||
reqres = {headers:{'content-type':'application/json'}, body:''} | ||
lint.json(reqres, null, null, [])[0].type.should.eql 'invalid_json' | ||
|
||
it 'should ignore non-JSON Content-Types', () -> | ||
reqres = {headers:{'content-type':'application/xml'}, body:''} | ||
lint.json(reqres, null, null, []).should.eql [] | ||
|
||
it 'should return no error on valid JSON', () -> | ||
reqres = {headers:{'content-type':'application/json'}, body:'{}'} | ||
lint.json(reqres, null, null, []).should.eql [] |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../.coffee.mk/test/mocha.opts |