Skip to content

Commit

Permalink
Comment out a couple of missing tests, add in one that only existed i…
Browse files Browse the repository at this point in the history
…n Lua, and make the existing ones less noisy while they wait for a result
  • Loading branch information
cmsj committed Nov 3, 2022
1 parent da9cd4d commit 22199ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 11 additions & 5 deletions Hammerspoon Tests/HShttp.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ - (void)testHttpDoAsyncRequestWithCachePolicyParam {
RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5)
}

- (void)testHttpDoAsyncRequestWithRedirectParamButNoCachePolicyParam {
RUN_LUA_TEST()
}

- (void)testHttpDoAsyncRequestWithNoEnableRedirectParam {
- (void)testHttpDoAsyncRequestWithoutEnableRedirectAndCachePolicyParam {
RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5)
}

// There's no Lua counterpart for this yet
//- (void)testHttpDoAsyncRequestWithRedirectParamButNoCachePolicyParam {
// RUN_LUA_TEST()
//}

// There's no Lua counterpart for this yet
//- (void)testHttpDoAsyncRequestWithNoEnableRedirectParam {
// RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5)
//}

- (void)testHttpDoAsyncRequestWithRedirection {
RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5)
}
Expand Down
8 changes: 4 additions & 4 deletions extensions/http/test_http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _G["callback"] = function(code, body, headers)
end

function testHttpDoAsyncRequestWithCachePolicyParamValues()
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table") then
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table" and _G["respCode"] > 0) then
-- check return code
assertIsEqual(200, _G["respCode"])
assertGreaterThan(0, string.len(_G["respBody"]))
Expand Down Expand Up @@ -41,7 +41,7 @@ function testHttpDoAsyncRequestWithCachePolicyParam()
end

function testHttpDoAsyncRequestWithoutEnableRedirectAndCachePolicyParamValues()
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table") then
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table" and _G["respCode"] > 0) then
-- check return code
assertIsEqual(200, _G["respCode"])
assertGreaterThan(0, string.len(_G["respBody"]))
Expand Down Expand Up @@ -69,7 +69,7 @@ function testHttpDoAsyncRequestWithoutEnableRedirectAndCachePolicyParam()
end

function testHttpDoAsyncRequestWithRedirectionValues()
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table") then
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table" and _G["respCode"] > 0) then
-- check return code
assertIsEqual(200, _G["respCode"])
assertGreaterThan(0, string.len(_G["respBody"]))
Expand Down Expand Up @@ -98,7 +98,7 @@ function testHttpDoAsyncRequestWithRedirection()
end

function testHttpDoAsyncRequestWithoutRedirectionValues()
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table") then
if (type(_G["respCode"]) == "number" and type(_G["respBody"]) == "string" and type(_G["respHeaders"]) == "table" and _G["respCode"] > 0) then
-- check return code
assertIsEqual(301, _G["respCode"])
return success()
Expand Down

0 comments on commit 22199ba

Please sign in to comment.