Add test for HttpResponse

This commit is contained in:
Kegan Myers 2014-03-03 14:47:49 -06:00
parent fff51ff95f
commit e9cf9f5f17
2 changed files with 13 additions and 9 deletions

View file

@ -6,8 +6,8 @@ describe("Typertext.Http.HttpException", function () {
it("works according to the parent class", function () {
var inputString = "Test message",
inputCode = 239,
inputHttp = Typertext.Http.HttpResponseStatus.clientError;
var testClass = new Typertext.Http.HttpException(inputString, inputCode, inputHttp);
inputHttp = Typertext.Http.HttpResponseStatus.clientError,
testClass = new Typertext.Http.HttpException(inputString, inputCode, inputHttp);
expect(testClass.GetCode()).toEqual(inputCode);
expect(testClass.GetCustom()).toEqual(inputHttp);

View file

@ -1,16 +1,20 @@
describe("", function () {
describe("Typertext.Http.HttpResponse", function () {
it("exists", function () {
expect(typeof Typertext.Http.HttpException).toEqual("function");
expect(typeof Typertext.Http.HttpResponse).toEqual("function");
});
it("works according to the parent class", function () {
function hf(input) {
return "TestString" + input;
}
var inputString = "Test message",
inputCode = 239,
inputHttp = Typertext.Http.HttpResponseStatus.clientError;
var testClass = new Typertext.Http.HttpException(inputString, inputCode, inputHttp);
inputHttp = Typertext.Http.HttpResponseStatus.clientError,
testClass = new Typertext.Http.HttpResponse(inputHttp, hf, inputCode, inputString);
expect(testClass.GetCode()).toEqual(inputCode);
expect(testClass.GetCustom()).toEqual(inputHttp);
expect(testClass.GetMessage()).toEqual(inputString);
expect(testClass.GetContent()).toEqual(inputString);
expect(testClass.GetHeader("foo")).toEqual("TestStringfoo");
expect(testClass.GetHttpStatus()).toEqual(inputCode);
expect(testClass.GetStatus()).toEqual(inputHttp);
});
});