Add test for HttpResponse
This commit is contained in:
parent
fff51ff95f
commit
e9cf9f5f17
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
Reference in a new issue