Skip to content

Commit 4428c1f

Browse files
committed
refined age/expires tests
1 parent 787c47b commit 4428c1f

File tree

1 file changed

+46
-15
lines changed

1 file changed

+46
-15
lines changed

tests/explicit-freshness.js

+46-15
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default
5353
{
5454
response_headers: [
5555
['Expires', 60],
56-
['Date', 120]
56+
['Date', 70]
5757
]
5858
},
5959
{
@@ -75,6 +75,36 @@ export default
7575
}
7676
]
7777
},
78+
{
79+
name: 'HTTP cache does not reuse a response when the Age header is greater than its Expires freshness lifetime',
80+
requests: [
81+
{
82+
response_headers: [
83+
['Date', 0],
84+
['Expires', 10],
85+
['Age', '15']
86+
]
87+
},
88+
{
89+
expected_type: 'not_cached'
90+
}
91+
]
92+
},
93+
{
94+
name: 'HTTP cache does not reuse a response when the Age header is greater than its Expires freshness lifetime, and Date is fast',
95+
requests: [
96+
{
97+
response_headers: [
98+
['Date', 5],
99+
['Expires', 10],
100+
['Age', '8']
101+
]
102+
},
103+
{
104+
expected_type: 'not_cached'
105+
}
106+
]
107+
},
78108
{
79109
name: 'HTTP cache reuses a response with positive Cache-Control: max-age',
80110
requests: [
@@ -101,6 +131,21 @@ export default
101131
}
102132
]
103133
},
134+
{
135+
name: 'HTTP cache does not reuse a response when the Age header is greater than its Cache-Control: max-age freshness lifetime',
136+
requests: [
137+
{
138+
response_headers: [
139+
['Date', 0],
140+
['Cache-Control', 'max-age=10'],
141+
['Age', '15']
142+
]
143+
},
144+
{
145+
expected_type: 'not_cached'
146+
}
147+
]
148+
},
104149
{
105150
name: 'HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires',
106151
requests: [
@@ -175,20 +220,6 @@ export default
175220
}
176221
],
177222
browser_skip: true
178-
},
179-
{
180-
name: 'HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime',
181-
requests: [
182-
{
183-
response_headers: [
184-
['Cache-Control', 'max-age=3600'],
185-
['Age', '12000']
186-
]
187-
},
188-
{
189-
expected_type: 'not_cached'
190-
}
191-
]
192223
}
193224
]
194225
}

0 commit comments

Comments
 (0)