-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
b296442
commit 268f24c
Showing
2 changed files
with
54 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
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,49 @@ | ||
/* | ||
* Celer - An HTTP framework | ||
* Copyright(c) 2017-present @GavinDmello | ||
* MIT Licensed | ||
*/ | ||
|
||
//Requiring the dev-dependencies | ||
var chai = require('chai') | ||
var expect = chai.expect | ||
var assert = chai.assert | ||
|
||
describe('checking response methods', () => { | ||
|
||
const ResponseWrapper = require('../lib/response') | ||
const responseWrapper = new ResponseWrapper() | ||
responseWrapper.write = function(params) {} | ||
responseWrapper.end = function(params) {} | ||
|
||
|
||
it('with string param', (done) => { | ||
try { | ||
responseWrapper.send("Hello") | ||
} catch (e) { | ||
assert.fail("Error in response", "string param", e.toString()) | ||
} | ||
done() | ||
}) | ||
|
||
it('with object param', (done) => { | ||
try { | ||
responseWrapper.send({ a : 1}) | ||
} catch (e) { | ||
assert.fail("Error in response", "object param", e.toString()) | ||
} | ||
done() | ||
}) | ||
|
||
it('with number param', (done) => { | ||
try { | ||
responseWrapper.send(1) | ||
} catch (e) { | ||
done() | ||
return | ||
} | ||
assert.fail("should fail before", "numbers are not allowed", "") | ||
|
||
}) | ||
|
||
}) |