var lib = require("./lib");

var response = { headers: { "cache-control": "max-age=60, public" }, body: "Hello, World" };
var expected = [
	{ headers: { "x-cache": "MISS", "cache-control": "max-age=60, public" }, body: "Hello, World" },
	{ headers: { "x-cache": "HIT",  "cache-control": "max-age=60, public" }, body: "Hello, World" },
	{ headers: { "x-cache": "HIT",  "cache-control": "max-age=60, public" }, body: "Hello, World" }
];

var service = lib.createService(response);

service.request(expected.length, function (actual) {
	for (var i = 0; i < actual.length; i++) {
	    lib.responseEqual(actual[i], expected[i]);
	}
	service.shutdown();
});

@@ -22,16 +22,41 @@
 lib%22);%0A%0A
+var NOW = 198025200000;%0A%0A
 var resp
@@ -140,16 +140,17 @@
 rld%22 %7D;%0A
+%0A
 var expe
@@ -157,14 +157,22 @@
 cted
+_miss
  = %5B%0A
-%09
+    
 %7B he
@@ -256,33 +256,363 @@
 ello, World%22 %7D,%0A
-%09
+    %7B headers: %7B %22x-cache%22: %22HIT%22,  %22cache-control%22: %22max-age=60, public%22 %7D, body: %22Hello, World%22 %7D,%0A    %7B headers: %7B %22x-cache%22: %22HIT%22,  %22cache-control%22: %22max-age=60, public%22 %7D, body: %22Hello, World%22 %7D%0A%5D;%0A%0Avar expected_hit = %5B%0A    %7B headers: %7B %22x-cache%22: %22HIT%22,  %22cache-control%22: %22max-age=60, public%22 %7D, body: %22Hello, World%22 %7D,%0A    
 %7B headers: %7B %22x-
@@ -692,17 +692,20 @@
 rld%22 %7D,%0A
-%09
+    
 %7B header
@@ -840,16 +840,145 @@
 onse);%0A%0A
+lib.step(%5B %0A%0A    function (callback) %7B%0A%0A        Date.prototype.getTime = function() %7B%0A            return NOW;%0A        %7D%0A%0A        
 service.
@@ -993,16 +993,21 @@
 expected
+_miss
 .length,
@@ -1027,17 +1027,28 @@
 tual) %7B%0A
-%09
+            
 for (var
@@ -1081,17 +1081,28 @@
  i++) %7B%0A
-%09
+            
     lib.
@@ -1138,18 +1138,556 @@
 cted
+_miss
 %5Bi%5D);%0A
-%09%7D%0A%09
+            %7D%0A            callback();%0A        %7D);%0A%0A    %7D,%0A%0A    // Should get a cache miss the first time, because we're 120 seconds%0A    // on.%0A    function (callback) %7B%0A%0A        Date.prototype.getTime = function() %7B%0A            return NOW + 120000;%0A        %7D%0A%0A        service.request(expected_miss.length, function (actual) %7B%0A            for (var i = 0; i %3C actual.length; i++) %7B%0A                lib.responseEqual(actual%5Bi%5D, expected_miss%5Bi%5D);%0A            %7D%0A            callback();%0A        %7D);%0A%0A    %7D,%0A%0A    function (callback) %7B%0A        
 serv
@@ -1702,12 +1702,19 @@
 down();%0A
-%7D
+    %7D%0A%0A%5D
 );%0A

Check that after 120 seconds, previously cached content becomes uncached.