test: add another session duration test

We test that the session is cleared after it expires, but we don't
check that it's still there just before it expires, at least not in
the same way.
This commit is contained in:
Francois Marier 2013-08-30 14:18:39 +02:00
Родитель 8073c65af3
Коммит fe65d9a5f3
1 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -415,6 +415,43 @@ suite.addBatch({
}
});
suite.addBatch({
"querying twice, each at 1/4 duration time": {
topic: function() {
var self = this;
var app = create_app_with_duration();
app.get("/bar", function(req, res) {
req.session.baz = Math.random();
res.send("bar");
});
app.get("/bar2", function(req, res) {
self.callback(null, req);
res.send("bar2");
});
var browser = tobi.createBrowser(app);
// first query resets the session to full duration
browser.get("/foo", function(res, $) {
setTimeout(function () {
// this query should NOT reset the session
browser.get("/bar", function(res, $) {
setTimeout(function () {
// so the session should still be valid
browser.get("/bar2", function(res, $) {
});
}, 200);
});
}, 200);
});
},
"session still has state": function(err, req) {
assert.isDefined(req.session.baz);
}
}
});
suite.addBatch({
"querying twice, each at 3/4 duration time": {
topic: function() {